When I use Global.asax file for url rewriting purposes, I use Application_BeginRequest and follow up the code :
protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext InRequest = HttpContext.Current;
string OldPath = InRequest.Request.Path.ToLower();
if (InRequest.Request.RawUrl.Split('/').Length > 3)
{
string Path = InRequest.Request.RawUrl.Split('/')[2];
Path = "/" + Path + "/";
string NewPath = "/abc/" + WebConfigurationManager.AppSettings[Path];
string ItemName = InRequest.Request.RawUrl.Split('/')[InRequest.Request.RawUrl.Split('/').Length - 1].Split('.')[0];
string ID = InRequest.Request.RawUrl.Split('/')[3];
InRequest.RewritePath(NewPath, "", "?id=" + ID, true);
}
}
However the Code is working fabulous but it dusturbs my website design when i run on local host, I think their is problem with iis can anyone help me?