- Open vsual studio
- Create a class library project
- add system.web reference
- inherit IHttpModule
- Put the code below
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
namespace ModuleHttp
{
public class ModuleRedirect1 : IHttpModule
{
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);
}
void context_BeginRequest(object sender, EventArgs e)
{
// throw new Exception("The method or operation is not implemented.");
HttpApplication oApp = (HttpApplication)sender;
if (oApp.Request.RawUrl.Contains("/_layouts/mngsiteadmin.aspx"))
{
oApp.Response.Redirect(oApp.Request.RawUrl.Remove(oApp.Request.RawUrl.LastIndexOf("/")) + "/copy_mngsiteadmin.aspx");
}
}
public void Dispose()
{
}
}
}
6. deploy the code
7. put the code in assembly / GAC
No comments:
Post a Comment