Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there

I am working on a web project in asp.net C# .

I want to display a user-friendly url in the web browser but would like to redirect it
according to my search id.

For example lets say a user writes a url www.abc.com/rock/stone.
but this should be redirected to www.abc.com/xyz.aspx?cat=rock&id=stone.
and even after redirecting the url should be displayed as www.abc.com/rock/stone.

Please help me out with this issue.

Thanks in advance.
Posted
Comments
Sergey Alexandrovich Kryukov 6-Jan-13 1:10am    
If this is ASP.NET, add the tag "ASP.NET".
—SA

There are two similar or related by different approaches. One is URL routing, another is URL rewriting:
http://msdn.microsoft.com/en-us/library/cc668201%28v=vs.100%29.aspx#aspnet_routing_versus_url_rewriting[^],
http://en.wikipedia.org/wiki/URL_rewriting[^].

The manual on routing: http://msdn.microsoft.com/en-us/library/cc668201%28v=vs.100%29.aspx[^].

On rewriting: http://msdn.microsoft.com/en-us/library/ms972974.aspx[^].

You will find all you need. Good luck,
—SA
 
Share this answer
 
 
Share this answer
 
Comments
eku123 7-Jan-13 10:50am    
thanks to both of u ...but this is not solving my problem.

Let me reframe another question to solve my problem.

Consider that whenever a user writes a url in his browser after my domain i.e www.mysite.com/abc/cdf/cfg/asd
or
www.mysite.com/xyz/sad
.
.
.
I want that all this url should be automativally redirected in my Default.aspx(i.e my initial page ) so that i can later on use in to create my own search in C# in Default.aspx.cs -->pageload()event.
Please note: I should be able to read the url given by user and not the www.mysite.com/default.aspx

Plz guide me with the same.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900