serving the solutions day and night

Pages

Showing posts with label 404. Show all posts
Showing posts with label 404. Show all posts

Tuesday, August 16, 2011

ASP.NET Custom Errors(customErrors) and URL Mappings (urlMappings)

URL Mappings
  1. Open web.config file. (see MSDN)
  2. Create new urlMappings section within the system.web section.
  3. <urlMappings enabled="true">
    <add url="~/contactus.aspx" mappedUrl="~/index.aspx" />
    </urlMappings>
  4. If user types contactus.aspx, page mapped to the index.aspx.
  5. This approach won't work if you have 100 of pages to map.
  6. Best solution is to use regular expressions, but ASP.NET does not support. SEE
    URL Rewriting