protected void Application_BeginRequest(object sender, EventArgs e) { //Get the current http context HttpContext InRequest = HttpContext.Current; //Get the current path string OldPath = InRequest.Request.Path.ToLower(); //Check the path whether it is a contextual path 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]; //Rewrite the path with the actual path InRequest.RewritePath(NewPath, "", "?id=" + ID, true); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)