Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET3.0 C#
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 5-Jan-13 19:01pm
eku123290
Comments
Sergey Alexandrovich Kryukov at 6-Jan-13 1:10am
   
If this is ASP.NET, add the tag "ASP.NET".
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Comments
eku123 at 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)



Advertise | Privacy | Mobile
Web01 | 2.8.140709.1 | Last Updated 6 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid