Hi guys, I have following problem.
Our site makin url rewriting from www.mysite.com/cat=ivan_catid=iii.html to www.mysite.com/ivan_catid.html
I create new class which inherit IHttpModule and register it in web.config.
But iss7 told me that page not found with error 404 before I can run Begin_Request method for fix this link.
Can fix it somehow in iis or in web.config?
public class UrlInspector : IHttpModule
{
public UrlInspector()
{
//
// TODO: Add constructor logic here
//
}
public void Init(HttpApplication application)
{
application.BeginRequest += (new EventHandler(this.Application_BeginRequest));
}
private void Application_BeginRequest(Object source, EventArgs e)
{
string fixedLink = "";
if (!string.IsNullOrEmpty(fixedLink))
{
response.Clear();
response.Status = "301 Moved Permanently";
response.AddHeader("Location", fixedLink);
response.End();
}
}
}
public void Dispose() { }