hello sir
my class file code is
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for URLRewriter
/// </summary>
public class URLRewriter : IHttpModule
{
//public URLRewriter()
//{
// //
// // TODO: Add constructor logic here
// //
//}
#region IHttpModule Members
/// <summary>
/// Dispose method for the class
/// If you have any unmanaged resources to be disposed
/// free them or release them in this method
/// </summary>
public void Dispose()
{
//not implementing this method
//for this example
}
/// <summary>
/// Initialization of the http application instance
/// </summary>
/// <param name="context"></param>
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);
}
/// <summary>
/// Event handler of instance begin request
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void context_BeginRequest(object sender, EventArgs e)
{
//Create an instance of the application that has raised the event
HttpApplication httpApplication = sender as HttpApplication;
//Safety check for the variable httpApplication if it is not null
if (httpApplication != null)
{
//get the request path - request path is something you get in
//the url
string requestPath = httpApplication.Context.Request.Path;
//variable for translation path
string translationPath = "";
//if the request path is /urlrewritetestingapp/laptops/dell/
//it means the site is for DLL
//else if "/urlrewritetestingapp/laptops/hp/"
//it means the site is for HP
//else it is the default path
switch (requestPath.ToLower())
{
case "/government-exams/Bank%20Jobs/":
translationPath = "/Default.aspx?JobHeaderMenuName=Bank%20Jobs";
break;
case "/government-exams/SSC/":
translationPath = "/Default.aspx?JobHeaderMenuName=SSC";
break;
case "/government-exams/Railways/":
translationPath = "/Default.aspx?JobHeaderMenuName=Railways";
break;
default:
translationPath = "/government-exams/default.aspx";
break;
}
//use server transfer to transfer the request to the actual translated path
httpApplication.Context.Server.Transfer(translationPath);
}
}
#endregion
}
my aspx page is
<ul class="nav navbar-nav custom_nav">
<li class="active"><a href="http://latestsarkarijob.com">Home</a></li>
<li><a href="http://latestsarkarijob.com/government-exams/Bank%20Jobs/">Bank Jobs</a></li>
<li><a href="http://localhost:1090/government-exams/SSC/">SSC</a></li>
<li><a href="http://localhost:1090/government-exams/Railways/">Railways</a></li>
<li><a href="Default.aspx?JobHeaderMenuName=Freshers%20Jobs">UPSC</a></li>
<li><a href="Default.aspx?JobHeaderMenuName=Teaching Jobs">Teaching Jobs</a></li>
<li><a href="Default.aspx?JobHeaderMenuName=State PCS">State PCS</a></li>
<li><a href="Default.aspx?JobHeaderMenuName=Police">Police</a></li>
<li></li>
</ul>
but it is not work properly
this error is shown on web page