コード例 #1
0
        public TUser Login(string userName, string password, bool
                           isPersistent, string customData)
        {
            string userData;
            TUser  user = ValidateCredentials(userName, password,
                                              customData, out userData);

            if (user != null)
            {
                FormsAuthenticationTicket ticket =
                    new FormsAuthenticationTicket(
                        /* version */ 1, userName,
                        DateTime.Now, DateTime.Now.AddMinutes(30),
                        isPersistent,
                        userData,
                        FormsAuthentication.FormsCookiePath);
                string     encryptedTicket = FormsAuthentication.Encrypt(ticket);
                HttpCookie authCookie      = new HttpCookie(FormsAuthentication.
                                                            FormsCookieName, encryptedTicket);
                HttpContextBase httpContext = (HttpContextBase)ServiceContext.
                                              GetService(typeof(HttpContextBase));
                httpContext.Response.Cookies.Add(authCookie);
            }
            else
            {
                HttpContextBase httpContext = (HttpContextBase)
                                              ServiceContext.GetService(typeof(HttpContextBase));
                httpContext.AddError(new FormsAuthenticationLogonException(
                                         "Username or password is not correct."));
            }
            return(user);
        }
コード例 #2
0
ファイル: HttpContextWrapper.cs プロジェクト: litiian/spark-3
 public override void AddError(Exception errorInfo)
 {
     _context.AddError(errorInfo);
 }
コード例 #3
0
 public override void AddError(Exception errorInfo)
 {
     proxiedContext.AddError(errorInfo);
 }
コード例 #4
0
 public override void AddError(Exception errorInfo)
 {
     _inner.AddError(errorInfo);
 }
コード例 #5
0
 public override void AddError(System.Exception errorInfo)
 {
     _httpContext.AddError(errorInfo);
 }
コード例 #6
0
 public override void AddError(Exception errorInfo)
 {
     _httpContextBase.AddError(errorInfo);
 }
コード例 #7
0
 public override void AddError(Exception errorInfo)
 {
     _innerHttpContext.AddError(errorInfo);
 }