Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had same problem, I solved it by passing required data using authentication ticket to identity object. </p> <p>Then no objects need to be injected into membership providers.</p> <p>In my authentication code I have</p> <pre><code> [NonAction] private void SetAuthTicket(Member member, bool isPersistent) { HttpCookie cookie = Request.Cookies.Get(FormsAuthentication.FormsCookieName); FormsAuthentication.SetAuthCookie(member.Email, isPersistent); string userData = "|" + member.ID + "|" + member.Firstname + "|" + member.Lastname + member.Culture; FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, member.Email, DateTime.UtcNow, DateTime.UtcNow.AddDays(7), isPersistent, userData); string encryptedTicket = FormsAuthentication.Encrypt(ticket); cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); Response.Cookies.Add(cookie); } </code></pre> <p>And in Global.asax</p> <pre><code> void Application_OnPostAuthenticateRequest(object sender, EventArgs e) { IPrincipal user = HttpContext.Current.User; if (user.Identity.IsAuthenticated &amp;&amp; user.Identity.AuthenticationType == "Forms") { FormsIdentity identity = user.Identity as FormsIdentity; MyIdentity ai = new MyIdentity(identity.Ticket); MyPrincipal p = new MyPrincipal(ai); HttpContext.Current.User = p; System.Threading.Thread.CurrentPrincipal = p; if (!String.IsNullOrEmpty(ai.Culture)) { CultureInfo ci = new CultureInfo(ai.Culture); System.Threading.Thread.CurrentThread.CurrentUICulture = ci; System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(ci.Name); } } } </code></pre> <p>And in Identity class I have MemberName, Firstname and Lastname properties that return parts of ticket string.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload