protected void Application_BeginRequest(Object sender, EventArgs e) { string oldUrl = HttpContext.Current.Request.RawUrl;
string pattern = @"^(.+)News(/d+)/.html(/?.*)*$"; string replace = "$1NewsDetails.aspx?NID=$2"; if (Regex.IsMatch(oldUrl, pattern, RegexOptions.IgnoreCase | RegexOptions.Compiled)) { string newUrl = Regex.Replace(oldUrl, pattern, replace, RegexOptions.Compiled | RegexOptions.IgnoreCase); this.Context.RewritePath(newUrl); }
}