Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. protected void Application_AuthenticateRequest(object sender, EventArgs e)
  2. {
  3. if (Request.IsAuthenticated)
  4. {
  5. // check if we have the user in the cache
  6. var userPrincipal = PrincipalManager.GetPrincipal();
  7. if (userPrincipal == null || !userPrincipal.Identity.IsAuthenticated)
  8. {
  9. userPrincipal = new GenericPrincipal(new RoomixerIdentity(), null);
  10.  
  11. PrincipalManager.StorePrincipal(userPrincipal);
  12. }
  13.  
  14.  
  15. HttpContext.Current.User = userPrincipal;
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement