vb System.Web.ApplicationServices.CreatingCookieEventArgs.CustomCredential类(方法)实例源码

下面列出了vb System.Web.ApplicationServices.CreatingCookieEventArgs.CustomCredential 类(方法)源码代码实例,从而了解它的用法。

作者:VB.NET开发    项目:System.Web.ApplicationService   
Sub AuthenticationService_CreatingCookie(ByVal sender As Object, _
                 ByVal e As System.Web.ApplicationServices.CreatingCookieEventArgs)
    Dim ticket As FormsAuthenticationTicket = New _
       FormsAuthenticationTicket _
        (1, _
         e.Username, _
         DateTime.Now, _
         DateTime.Now.AddMinutes(30), _
         e.IsPersistent, _
         e.CustomCredential, _
         FormsAuthentication.FormsCookiePath)
        
    Dim encryptedTicket As String = FormsAuthentication.Encrypt(ticket)
    
    Dim cookie As HttpCookie = New _
        HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket)
    cookie.Expires = DateTime.Now.AddMinutes(30)
    
    HttpContext.Current.Response.Cookies.Add(cookie)
    e.CookieIsSet = True
End Sub


问题


面经


文章

微信
公众号

扫码关注公众号