Hi,
Probably the easiest way to do url rewrites in asp.net is to stick some code in Application_BeginRequest to read in the url and rewrite it. For an example lets say you have pages fed from a database, you want to make links like this
http://you.com/1234.aspx (where 1234 is a product ID) and then rewrite to
http://you.com/showproduct.aspx?id=1234
you could do something like this
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Dim incoming As HttpContext = HttpContext.Current
Dim str As String = incoming.Request.Path.ToLower
Dim product As Match = Regex.Match(str, "\d\d\d\d")
If product.Success Then
incoming.RewritePath("/ShowProduct.aspx?id=" & product.Value)
End If
End Sub
Obviously that's simple - you could make this as complex as you need. There's 1 drawback with this, or any other url rewrite method, that only requests for .aspx pages will actually reach the aspx engine so while you can easily rewrite
http://you.com/1234.aspx you couldn't rewrite something like
http://you.com/1234 as this request would throw a 404 in IIS before it even reached asp.net. The only way around this would be to set every page request to go through asp.net (not a good idea and almost certainly disallowed by shared hosts)
The other option may be to use a custom 404 page in IIS - bear in mind this could be viable because IIS does NOT send a 404 response code if you have a custom 404 page set up - so the search engines will not be aware they're going through a 404.
Cheers,
Jon