Calling custom module UrlAuthorization with every page load
I have implemented a custom UrlAuthorization module as shown here
The code looks like this:
public class CustomUrlAuthorizationModule : IHttpModule
{
public void Init(HttpApplication context)
{
context.AuthorizeRequest += new EventHandler(context_AuthorizeRequest);
}
void context_AuthorizeRequest(object sender, EventArgs e)
{
HttpApplication context = (HttpApplication)sender;
if (context.User != null && context.User.Identity.IsAuthenticated)
{
HttpContext _httpContext = context.Context;
SiteMapNode node = SiteMap.Provider.FindSiteMapNode(_httpContext);
if (node == null)
throw new UnauthorizedAccessException();
}
}
public void Dispose()
{
}
}
My question is, do I need to translate init from every page to boot, or is there a way to set IIS to do this automatically on every boot.
This question is probably very dumb ....
+2
source to share