> I just started using ASP.NET, though I've used the old
> ASP before. I'm trying to set up an application to use
> the Forms Authentication Module. Authentication mode is
> set to Forms and in my login page I have the following
> code:
>
> -- Begin Code --
> Dim ticket As New FormsAuthenticationTicket(1,
> txtUserID.Text, DateTime.Now, DateTime.Now.AddMinutes
> (5000), False, "Admin")
> Dim encryptedTicket As String =
> FormsAuthentication.Encrypt(ticket)
> Dim authCookie As New HttpCookie
> (FormsAuthentication.FormsCookieName, encryptedTicket)
> authCookie.Expires = DateTime.Now.AddHours(1)
> Response.Cookies.Add(authCookie)
> FormsAuthentication.RedirectFromLoginPage
> (txtUserID.Text, False)
> -- End Code --
>
> Then in Global.asax I put code in the
> Application_AuthenticateRequest event procedure to check
> the cookie and create a GenericPrincipal object if it
> exists and is valid. The problem is that the cookie I
> created and added in the Login.aspx form is no longer
> there when I attempt to retrieve it using
>
> Dim authCookie As HttpCookie = Context.Request.Cookies
> (cookieName)
>
> so every time I successfully log in, the
> AuthenticateRequest procedure doesn't find the cookie,
> doesn't make my GenericPrincipal object, and I get
> redirected back to the login page. WHY is that cookie no
> longer there?! I'm completely and absolutely stumped
> here. No matter what I do to it, I can't for the life of
> me make that cookie stick around.
Bookmarks