private static void SetPrincipal(HttpContextBase httpContext, string principalName) { WebIdentity identity = new WebIdentity(principalName); WebPrincipal principal = new WebPrincipal(identity); httpContext.User = principal; }
private static void SetAnonymous(HttpContextBase httpContext) { WebIdentity identity = WebIdentity.GetAnonymous(); WebPrincipal principal = new WebPrincipal(identity); httpContext.User = principal; }
/// <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; }