ASPX templates
Version 7.x > ASPX templates > Accessing static content outside of Kentico. View modes: 
User avatar
Member
Member
rne - 10/4/2012 2:58:27 PM
   
Accessing static content outside of Kentico.
When we add a page to our Kentico 7 project and try to visit this, it throws a 404 error.

Example:
When we add a page named TestPage.aspx to our Kentico project, then run the project or just view this page in a browser (by right clicking the file in Visual Studio, then selecting "View in Browser") it will give a 404 error.

It's not just static pages like this, but also images, CSS files, .js files, etc. that we want to include in our master pages, etc.

Now, we have found a way to bypass this, by moving all of these files to AppThemes, but is there any other way to get the static content to work correctly without having to use the "Exclude URL" functionality.

Right now, we can get things to work by putting the files in AppThemes. However, accessing a CSS file now looks something like this:
<link href="/AppThemes/[Name]//css/screen.css" rel="stylesheet" type="text/css" />

However, our previous CSSS link would have looked like this:
<link href="/css/screen.css" rel="stylesheet" type="text/css" />

The latter used to work just fine in Kentico 6. Also, in Kentico 6, if a page did not exist in Kentico, but it did exist as a static, physical file, then it would show this particular page.
Example: if /TestPage.aspx did not exist as a page in Kentico, but did exist as a physical page/file, then it would display this page correctly. Now it throws a 404 error instead.

Is there any setting that we are overlooking in the CMS or web.config or wherever? Or is putting stuff in AppThemes the only workaround?

Thanks.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 10/8/2012 1:25:15 AM
   
RE:Accessing static content outside of Kentico.
Hi,

What are your IIS settings for the v7 virtual directory/application?
What are the application pool settings?
I just tried it on my end and it is working just fine with .txt extension.
However, there was reported a similar bug to this which will be fixed in the Friday's hotfix - could you please apply then hotfix then and let us know?

Best regards,
Juraj Ondrus

User avatar
Member
Member
rne - 10/8/2012 8:07:23 AM
   
RE:Accessing static content outside of Kentico.
Thanks for your reply.

Regarding the IIS settings; as we are developing, we use Visual Studio 2010 and its integrated webserver. We don't have any IIS stuff configured on our local development machines.

I'll download and apply the hotfix on Friday to see if that makes a difference.

User avatar
Member
Member
rne - 10/12/2012 9:22:39 AM
   
RE:Accessing static content outside of Kentico.
Update:

Installed hotfix 7.0.3 today, which fixed the issue. Images, .js and .css files, etc. can now be included in our templates again without having to put them in App_Themes.

However, in the instructions PDF that comes with the hotfix it says the following:

"URL Rewriting & SEO - URLs of physical files that weren't excluded from the URL rewriting engine returned a page not found error instead of regular content."

This is correct for everything but ASPX pages. If I add a page named "test.html" to the root of my project, I can go to "http://localhost:[port]/test.html" the contents are displayed correctly.

However, if I rename this file "test.aspx", it immediately gives me a 404 error. I understand that Page Templates are .aspx files, and that the "Exclude URL" can be used to make this work.
Now, in the hypothetical situation where I would copy 20 folders filled with static ASPX pages into my Kentico site (pages that are not templates), I would have to exclude all of these.

Also, in previous implentations, sometimes we would point the Page Not Found / 404 URL to something like "/error404.aspx", which would then be availabe under "http://[domain]/error404.aspx" and would show correctly if a page could not be found. This page would be a non-template page, a static ASPX file.

Now, this 404 page has to be a page based on a template. Simply pointing to the error404.aspx will give another 404. If we add an error page in the CMS and set the URL to point to that page, it works correctly.

So, I know there's a work around, but technically, the issue for physical non-template ASPX pages remains.

User avatar
Kentico Support
Kentico Support
Accepted solutionAccepted solution
kentico_jurajo - 10/18/2012 1:33:41 AM
   
RE:Accessing static content outside of Kentico.
Hi,

I am sorry for the delay. The issue with the ASPX files will be fixed in the next hotfix. It is strange why the developer didn't fix it...We are sorry for this inconvenience.

Best regards,
Juraj Ondrus

User avatar
Member
Member
rne - 10/19/2012 7:54:07 AM
   
RE:Accessing static content outside of Kentico.
Awesome! Just downloaded and installed hotfix 7.0.4, and regular ASPX pages show up again without giving a 404.

User avatar
Member
Member
ddj-datacon - 10/18/2012 2:22:55 AM
   
RE:Accessing static content outside of Kentico.
Updating to Hotfix 3 solved the problem for me as well.

User avatar
Member
Member
vasiliy.ivanov1975-gmail - 4/30/2013 6:16:27 AM
   
RE:Accessing static content outside of Kentico.
Hello,

Trying to upgrade the existing website from version 6.0 to 7.0 (7.0.4640), I encountered with a similarly looking problem. Static files are well obtained from App_Themes directory, but not from App. Trying to access the files located in App directory, I get 404 error, which appears both in IIS logs and Kentico SiteManager Dashboard. I tried to deal with access permissions, but it didn't help.

It happens with Integrated application pull. But all works well when application pull is set to Classic. Does somebody have any suggestions?

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 4/30/2013 6:40:32 AM
   
RE:Accessing static content outside of Kentico.
Hello Vasiliy,

Could you please try to apply also the latest hotfix for version 7 as first?

Let me know if that helps.

Best regards,
Martin Danko

User avatar
Member
Member
vasiliy.ivanov1975-gmail - 5/16/2013 8:54:17 AM
   
RE:Accessing static content outside of Kentico.
Hello Martin,
Thank you for reply.

Indeed, the issue was cured by the hotfix of May 10th, now our Kentico version is 7.0.4877.

Best regards,
Vasiliy