Creating friendlier URLs in an ASP.NET WebForm application

klausstein

New Member
I have an ASP.NET WebForms application. What I am trying to do is create dynamic friendly URLs using \[code\]RewritePath\[/code\]. What I want to be able to do is grab the subdomain of the URL coming in, check a table in my database called \[code\]Domains\[/code\] and then depending on the subdomain, rewrite the url adding a query string of \[code\]?id=1\[/code\] or whatever the \[code\]id\[/code\] is.In addition, I would like the path to determine the page to load. So for example:\[code\]http://www.mysite.com should go to --> http://www.mysite.com/Default.aspxhttp://dog.mysite.com should go to --> http://www.mysite.com/MainPage.aspx?id=1http://cat.mysite.com should go to --> http://www.mysite.com/MainPage.aspx?id=2http://cat.mysite.com?p=15 should go to --> http://www.mysite.com/MainPage.aspx?id=2&p=15http://cat.mysite.com/OtherPage should go to --> http://www.mysite.com/OtherPage.aspx?id=2http://cat.mysite.com/OtherPage?p=15 should go to --> http://www.mysite.com/OtherPage.aspx?id=2&p=15\[/code\]Hopefully the examples give you the idea that I am looking for. I would prefer to be able to do this from the global.asax file because I do not have access to the IIS web server machine to be able to install some server-side module for URL rewriting. Thanks in advance for the help
 
Back
Top