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

 
  • Followers