Ejemplo n.º 1
0
        private static void SetPrincipal(HttpContextBase httpContext, string principalName)
        {
            WebIdentity  identity  = new WebIdentity(principalName);
            WebPrincipal principal = new WebPrincipal(identity);

            httpContext.User = principal;
        }
Ejemplo n.º 2
0
        private static void SetAnonymous(HttpContextBase httpContext)
        {
            WebIdentity  identity  = WebIdentity.GetAnonymous();
            WebPrincipal principal = new WebPrincipal(identity);

            httpContext.User = principal;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebPrincipal"/> class.
 /// </summary>
 /// <param name="identity">The identity that should be used as primary for principal.</param>
 public WebPrincipal(WebIdentity identity)
 {
     if (identity == null)
     {
         throw new ArgumentNullException("identity");
     }
     _identity = identity;
 }