5/19/2012

Get URL after Rewrite in C#

When you use the URL rewrite module in C# with mod_rewrite rules like  www.domain.com/products/clothes

you can easy to get anything after www.domain.com by use below code

HttpContext context = HttpContext.Current; string value = context.Request.RawUrl;

and you can get it /products/clothes  .Using function Regex to Split that string

string[] url = Regex.Split(value, Regex.Escape("/"));

Categories:
If You Enjoyed This Post Please Take 5 Seconds To Share It.

0 comments:

Post a Comment

 
  • I'm a great believer that any tool that enhances communication has profound effects in terms of how people can learn from each other, and how they can achieve the kind of freedoms that they're interested in.

  • Followers