Dynamic URLs to Static?

I want to be able to convert my dynamic links (i.e. http://www.mysite.com/products/product.aspx?ID=145) to static URLs (i.e. http://www.mysite.com/products/products/ID/145, or http://ww.mysite.com/products/145.htm) or something similar that will get indexed by the search engines, obviously without actually producing static pages for all of the produts.
Is there any easy way of doing this? I've seen some ISAPI products that seem to suggest that they do this... My site is hosted elsewhere, so I am not sure I can install ISAPI or other (non ASP.NET) solutions.
Anyone have any tricks/tips?
Who is Participating?

Here's an article that will get you up and running: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/urlrewriting.asp. I would write more info for you, but it's all there for you. I quote, "URL rewriting can be implemented either with ISAPI filters at the IIS Web server level, or with either HTTP modules or HTTP handlers at the ASP.NET level. This article focuses on implementing URL rewriting with ASP.NET, so we won't be delving into the specifics of implementing URL rewriting with ISAPI filters" which deals with your problem with having more limited access to dealing with things on the server level.

Note: "Since all of the HTTP modules will have been initialized prior to the custom HTTP handler factory being instantiated, using an HTTP handler factory presents the same challenges when placing the URL rewriting in the latter stages of the events—namely, file authorization will not work. So, if you rely on Windows authentication and file authorization, you will want to use the HTTP module approach for URL rewriting."

ctudorpriceAuthor Commented:
Thanks, Ted. MSDN: Why use a few words when a few thousand would do? I hate the Microsoft msdn articles. I find them but turning all the background info into a simple, implementable solution is always difficult. (That's why I come to EE for quick, simple answers).
Here's what I did (simplified)... In the global.asax.vb:

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Dim incoming As HttpContext = HttpContext.Current
Dim oldpath As String = incoming.Request.Path.ToLower
if oldpath="/product/myproduct.aspx" then
end if
end sub
Sounds good ctudorprice. Nice summary ;-)

Hopefully you don't have reams of code to cover all your pages - you could modify the above so that it just parses it all together: i.e. productlister1.aspx, which would cover all pages with less code, but if you've just got a few pages, much nicer result.

ctudorpriceAuthor Commented:
Hi ovalsquare,
the solution I implemented does actually parse the inbound URL...
One thing I was hoping to do was to be able to use directories (i.e. http://www.mysite.com/product/1/) but it appears that the server looks for a default document in that dir before the Application_BeginRequest fires. So now, I have to code the URLs as http://www.mysite.com/product/1.aspx for the Application_BeginRequest to fire. Am I missing something?
So you were planning on putting one document per directory? How about posting your code, then I'm not barking up the wrong alley.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.