Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server Error in '/' Application. This type of page is not served

I have an host where I hosted a webpage with .cshtml extension. My host is arvixe.com that provides ASP and .NET hosting but when I try to load my web page I get this error message.

Server Error in '/' Application.

This type of page is not served.

Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.cshtml' may be incorrect. Please review the URL below and make sure that it is spelled correctly.

Requested URL: /samples/WoT/Default.cshtml

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.276

I read something does I have to write something in my web.config file to make it work like this

<compilation>
  <assemblies>
    <add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </assemblies>
  <buildProviders>
    <add extension=".cshtml" type="System.Web.WebPages.Razor.RazorBuildProvider, System.Web.WebPages.Razor"/>
  </buildProviders>
</compilation>

But I tried everything, paste it in on different lines, nothing worked. What do I miss or do wrong?

like image 506
Dave Kischel Avatar asked Aug 23 '12 07:08

Dave Kischel


1 Answers

I believe you are not making using the MVC feature and trying to load just the razor view outside views or custom Area folders.

Then you need to enable webpages key in Web.config which is disabled by default in .Net 4.0

<add key="webpages:Enabled" value="true" />
like image 95
Nayan Avatar answered Sep 18 '22 04:09

Nayan