System.web.routing on web server does not work

I read all these articles on how to make system.web.routing work, but all these articles are explained on localhost: port. I can make it work on the local machine, but as soon as I upload the site to the server, Routing stops working no matter what I do.

At first I tried without the extension (.aspx), but after all the efforts I gave up and added the extension, but still it does not work on the server.

Any help is appreciated.

Example:

in global.ascx

Route test = new Route("home.aspx", new TestRoutingHandler());
Routes.Add(test); 

in the routing handler

public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
    string virtualPath = string.Empty;
    Route route = (Route)requestContext.RouteData.Route;
    virtualPath = "~/Default.aspx";
    return (Page)BuildManager.CreateInstanceFromVirtualPath(virtualPath, typeof(Page));
}

In web.config under httpModules

add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" 

It is so simple and works on the local computer, but not on the web server.

+3
source share
2 answers

, - ASP.NET( ). , ASP.NET, .aspx. , .

Phil Haack , IIS 6.

IIS 7 , system.webServer web.config.

0

IIS7 + , web.config :

<modules runAllManagedModulesForAllRequests="true" />

, VS, - Cassini, .

+2

Source: https://habr.com/ru/post/1708924/


All Articles