tags:

views:

33

answers:

1

I have a .NET app and I let users to create their account.

Right now the user page looks like http:///user/?user=guru

I have a user subfolder at the app root and that is where the aspx pages for user page are

How can I let my users access their pages like twitter, facebook or youtube?

Their user profile\channel\account has this format: http://www.facebook.com/guru

This way the URL is short and easy to remember and share

Thanks

+2  A: 

This is called "url rewriting". You have some code that takes the original “facebook.com/guru” URL and coverts it into the “facebook.com/?user=guru” URL before the hosting application tries to process it.

Depending on your web server, there is probably a module already built that lets you do this. In IIS, you can either use a custom HttpModule or the URL rewriting module.

David
Make sure you use exceptions for URL rewriting. Good ones start with a @ character.
Ton
Ton,Please explain a bit more...
Projapati
David,I am using IIS. One question though: if I rewrite URL, will user see the rewritten url if he refreshes the page?I mean user goes to the short url and hit page refresh, will it cause the page to be /user/?user=guru instead of original /guru?
Projapati
On apache the user/webclient only uses the 'user friendly url', only when they enter the webserver (IIS in your case) they get transformed. I assume that's the same for IIS
Ton
If you refresh the page, you'll stay on the rewritten URL. You do have to be careful about URLs that are dynamically generated in the resulting HTML. If you are doing this manually, you'll have to change the "action" attribute on the "form" tags. If you are using the URL rewriting module from the IIS.net site, I think it might handle this for you.
David