URL Rewriting

Discussion in 'ASP.NET 2.0' started by felixters, Jul 7, 2008.

  1. What is the preferred DASP method for achieving a url such as the following:

    http://www.website.com/somepage

    where '/somepage' is mapped to:

    http://www.website.com/somepage.aspx

    I have already written code that implements the IHttpModule and can reroute a request once it's handed to asp.net, but that only works in cassini and not in a production env. In the production env, IIS reroutes the request as a 404 file not found because, well, there is no file!

    At any rate, I don't want to create a somepage directory with a default.aspx and a server transfer in it, that would defeat the purpose.
     
  2. If you're using IIS7, do a Google on System.Web.Routing.

    If you're using IIS6, you can have the wildcard mapping set to .NET by opening a support ticket then you can use an HttpModule or code in your global.asax.cs to do the rewrite - beware though that this routes ALL requests through .NET including images, css, whatever and URL rewriting can be a bear.
     
  3. We're on IIS6 I believe.

    I already have a module written to handle url rewriting. I've never made the switch to have wildcard mapping... I don't really know what affects that will have with the rest of the site. I suppose I'll have to look at simulating it on my development box. Do you have any links showing how to set it up for a single virtual directory?

    Thanks!
     

Share This Page