xdrtas
xdrtas

Reputation: 23

Error HTTP 403.14 in MVC 4 when url: "{controller}/{action}.aspx"

I'm trying to show a complete URL with MVC 4 web application like: localhost:8888/index.aspx, i want to show the complete URL in the browser. I found similar questions here and in this answer: https://stackoverflow.com/a/8557085 They say that the file extension can be seen.

But when i change the routes objetc like this:

routes.MapRoute(
     name: "Default",
     url: "{controller}/{action}.aspx",
     defaults: new { controller = "PaymentPortal", action = "PaymentPortal", id = UrlParameter.Optional }
);

or

routes.MapRoute(
     name: "Default",
     url: "{controller}/{action}/{id}.aspx",
     defaults: new { controller = "PaymentPortal", action = "PaymentPortal", id = UrlParameter.Optional }
);

I get the next error: Error HTTP 403.14 - Forbidden

I try the next fixes, in the class RegisterRoutes i add the next line: routes.RouteExistingFiles = true;

In web.config i add, remove and change a few things like:

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
  <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
  <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
  <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
  <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
  <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<modules runAllManagedModulesForAllRequests="true"/>

I play with the ExtensionlessUrlHandler adding, deleting and changing the tags and the values but nothing. I add the modules runAllManagedModulesForAllRequests="true" but nothing either.

I'm working with VS2012 in Windows 8, MVC 4 with ASPX engine. Any help would be appreciate, thank you very much!

P.D.: My apologies if i made some mistake with my english.

Upvotes: 0

Views: 592

Answers (1)

matt_lethargic
matt_lethargic

Reputation: 2796

I've just made a new MVC 4 application and created the routes:

routes.MapRoute(
    name: "Test",
    url: "{controller}/{action}.aspx",
    defaults: new {controller = "Home", action = "Index"}
    );

routes.MapRoute(
    name: "TestId",
    url: "{controller}/{action}/{id}.aspx",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );

routes.MapRoute(
    name: "Default",
    url: "{controller}/{action}/{id}",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

And the these url work

http://localhost:62312/Home/index/123test.aspx
http://localhost:62312/Home/index.aspx

Remember the order in which you create routes is important as well.

Upvotes: 1

Related Questions