Mapping folders to Asp.net
IIS tips and tricks

If you need to have an extensionless URL map to ASP.net 2.0, here are three options.
Have http://www.mywebsite.com/calendar/ map to http://www.mywebsite.com/calendar.aspx
ISAPI 2.7
RewriteRule ^/calendar/ calendar.aspx [I,R]
Update the Global.asax file of your website. Add code to Application_BeginRequest that will capture the URL that caused the 404 error.
Global.asax sample
Read Serve extensionless URL without using ISAPI handler or wildcard mapping for a good explanation of this method.
- Add a Wildcard mapping in Internet Information Services for your website
- 3rd party software, such as ISAPI 2.7 or higher
- Redirect 404 errors to 404.aspx and use Global.asax to capture the URL that caused the 404 error
Have http://www.mywebsite.com/calendar/ map to http://www.mywebsite.com/calendar.aspx
Add Wildcard mapping
Wildcard mapping will result in all requests being forwarded to asp.net. Which includes.html, .htm, .css, .js, images, etc. This will result in a performance hit.- Start IIS
- Right click on the Website, "Default Web Site" is a common name
- Click Properties
- Click Home Directory
- Click Configuration
- On Mappings tab click Add
- Executable = link to the asp.net dll. Example: c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
- Extension = .*
- Limit to: GET, POST
3rd party software, such ISAPI
You can install ISAPI and add a regular expression to redirect the url. The regular expression below will perform the redirect for the example at the top of this article.ISAPI 2.7
RewriteRule ^/calendar/ calendar.aspx [I,R]
404 Errors
Update IIS to redirect 404 errors to 404.aspx.Update the Global.asax file of your website. Add code to Application_BeginRequest that will capture the URL that caused the 404 error.
Global.asax sample
Read Serve extensionless URL without using ISAPI handler or wildcard mapping for a good explanation of this method.
Hopefully this helps!



Great site. I like the way you explain everything without using complicated terms.
Left by Craft Fairs | Dec. 24, 2009 at 1:05am
Thanks a lot Craft Fairs.
Left by Ken at SC | Dec. 28, 2009 at 12:35pm
That's great, I never thought about Mapping folders to Asp.net like that before.
Left by traslochi internazionali milano | Dec. 30, 2009 at 10:58pm
Leave a Comment