Lumino - veibeskrivelse
Routing was introduced with ASP.NET 4.0, and it works like a charm. However, to make routing work properly, most of us would add a setting to web.config
Without this, IIS would only run managed modules for known ASP.NET resources (for example, .aspx files). If we, for example, request the url http://www.luminowebdesign.no/default.aspx, then IIS will see that this is a know ASP.NET resource and process it correctly. However, if we use routing and request http://www.luminowebdesign.no/forsiden - which in our system is the same page, then IIS will not understand that it should process this page. The "runAllManagedModulesForAllRequests=true" would fix this, as IIS now will run all managed modules for every single request - but the fix comes at at performance cost.
An alternative to the above setting, is to specify the managed modules we want to run. Obviously, we want to run the UrlRoutingModule as specified below. However, it is also now easy to introduce potential bugs, since IIS will not cause the other managed modules to fire and commonly used functionality might suddenly disappear. For example, if we did not specify SessionStateModule in the config setting below, then any pages using routing would get an exception when trying to use Session.
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition=""/>
There might be other modules you want to have running, such as Forms Authentication, Windows Authentication, as so on.
Happy Routing :)
Last ned takeaway app!
© powered by Lumino