Most of the times we have to write the Module or handler for the URL Re-Writing we also have to mark its registration in the web.config file but there also a simple way to achieve it.
Below is the code snippet from the Global.asax file.
protected void Application_BeginRequest(object sender, EventArgs e)
{
try
{
HttpContext myContext = HttpContext.Current;
myContext.RewritePath(Request.QueryString["PageName"].ToString());
}
catch (Exception ex)
{
Response.Write("ERR in Global.asax :" + ex.Message + "\n\n" + ex.StackTrace.ToString() + "\n\n");
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment