I am trying to implement Authentication and Authorization using a custom HTTPModule.
I am trying to implement Authentication and Authorization using a custom HTTPModule.
using System;
using System.Web;
namespace MyModule
{ public class MyModule : IHttpModule
{
public void Init(HttpApplication application)
{
application. AcquireRequestState += (new
EventHandler(this.Application_AcquireRequestState));
}
private void Application_AcquireRequestState (Object source,
EventArgs e)
{
HttpApplication Application = (HttpApplication)source;
User user=Application.Context.Sesseion["User"] ;
string url=Application.Context.Request.Path;
Module module= //how to write this?????????????//
If(!RightChecker.HasRight(user,module))
Application.Context.Server.Transfer("ErrorPage.aspx");
}
public void Dispose()
{
}
}
}
thanks!!!