In ASP.net 4.0 , New functionality included for URL Routing.
For Example : ( Application_Start)
RouteTable.Routes.MapPageRoute("Default","Home","~/Default.aspx");
When Browser request for http://<<your site>>/Home, It will route to page Default.aspx
And Page has some property that allow you to get route data, Page.RouteData
Even generic route is also possible.
Now When request made for Url : http://<<yoursite>/Test It automatically route to Test.aspx
One more thing true about ASP.net 4.0 routing is even though routing is done, there is still possible that direct request for “ASPX” pages.
To disable that
1. from UI (IIS 7.0 or later)
- Go to inetmgr
- In Feature View go to “Request Filtering”
- Click Deny FileName Extension
2. Using main web.config file of your application
<system.webServer>- Add Module tag with runAllManagedModulesForAllRequests = “true”
<modules runAllManagedModulesForAllRequests="true" />
<security>
<requestFiltering>
<fileExtensions>
<add fileExtension=".aspx" allowed="false" />
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
- Add requestfiltering with fileextension=”.aspx” and “allowed=false”.
Let me know your comment on this.
No comments:
Post a Comment