Modify Template to prevent Server Error - Runtime Errors

Tips submitted by ASP.NET Maker users

Modify Template to prevent Server Error - Runtime Errors

Postby xgis » Fri Dec 27, 2013 12:24 am

When using IIS 7.5-8.5 it is not uncommon to get "Server Error in '/' Application - Runtime Error" with the new MVC page extensions (*.CSHTML).
These often occur on mobile devices for the mobilemenu.cshtml page, which often makes it difficult or confusing when trying to get back to the default or login pages.
To ensure the IIS webserver knows which pages it should be rendering the following simple template modification can be made to ensure this issue does not occur or is far less frequent.
After the change is made every web application rendered using ANM10.x will issue the same pages to the live webserver.
Warning: Ensure you make a copy of your template before you make these changes.

In the template file "" you need to edit the web.config file. Drag it to an editable location such as the desktop.
Open it in notepad and add the following codes by selecting the line "</system.webServer>" and pasting over it;

<remove value="default.aspx" />
<remove value="iisstart.htm" />
<remove value="index.html" />
<remove value="index.htm" />
<remove value="Default.asp" />
<add value="default.cshtml" />
<add value="login.cshtml" />
<add value="mobilemenu.cshtml" />

Then resave the web.config and add it back to your template.
When you render the project it will ask you to overwrite the existing template. Select "Overwrite".
After the project is rendered check your application web.config and observe the changes.
FTP or transfer the project to your LIVE webserver.
Open IIS and check the "Default Document" for your LIVE website.
Hopefully this may resolve the "Server Error in '/' Application - Runtime Error" you may be experiencing.
Posts: 87
Joined: Thu Jan 17, 2013 10:40 pm

Return to User Submited Tips (ASP.NET Maker)