Skip to content

Instantly share code, notes, and snippets.

@sniffdk
Created February 28, 2012 21:06
Show Gist options
  • Save sniffdk/1935137 to your computer and use it in GitHub Desktop.
Save sniffdk/1935137 to your computer and use it in GitHub Desktop.
public class SecurityModule : IHttpModule
{
private const string Key = "PageAccessAllowed";
public void Dispose()
{
}
public void Init(HttpApplication context)
{
context.PostAuthorizeRequest += (sender, args) =>
{
var disclaimer = StaticNodes.Disclaimer;
if (context.Request.RawUrl.StartsWith(disclaimer.Url))
{
return;
}
if (context.Session[Key] as string != null) return;
if (context.Request.Cookies[Key] != null) return;
context.Response.Redirect(disclaimer.Url, true);
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment