Created
October 19, 2010 13:30
-
-
Save ArnisL/634190 to your computer and use it in GitHub Desktop.
globalasax.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Interreg.Web{ | |
using System; | |
using System.Security.Principal; | |
using System.Web.Security; | |
using MvcExtensions.StructureMap; | |
public class MvcApplication:StructureMapMvcApplication{ | |
//ignore this bullshit code... | |
protected void Application_AuthenticateRequest(Object sender,EventArgs e){ | |
var authCookie=Context.Request.Cookies[FormsAuthentication.FormsCookieName]; | |
if(authCookie==null||authCookie.Value=="") return; | |
var authTicket=FormsAuthentication.Decrypt(authCookie.Value); | |
var roles=authTicket.UserData.Split(new[] {','}); | |
if(Context.User!=null) Context.User=new GenericPrincipal(Context.User.Identity,roles); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment