Problem with Forms Authentication
From: David C. Taylor (dtaylor_at_harc.edu)
Date: 08/11/03
- Next message: Alek Davis: "Re: Decrypt string encrypted with SHA1"
- Previous message: Redeye: "Re: User has to login twice. Why??"
- Next in thread: Joseph: "Re: Problem with Forms Authentication"
- Reply: Joseph: "Re: Problem with Forms Authentication"
- Reply: Tian Min Huang: "RE: Problem with Forms Authentication"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 11 Aug 2003 10:37:40 -0700
I have an application using FormsAuthentication that does
not persist the authentication cookie beyond the session
so each time a user starts a session they must go through
the login page. On this login page I set a couple of
session variables while I am making the database trip for
authentication. This all works fine without any problems.
Now, I have the requirement to provide an option for a
user to 'Remember Me' using a checkbox and persisting the
cookie. The result is that users that take this option
will bypass the login page and the setting of the
necessary session variables. I decided to write the data
to the cookie as the FormsAuthenticationTicket.UserData
property and then retrieve it. I am using the MSDN
documentation for that property and the example shows how
to retrieve that value using this code in VB.Net:
Dim id As FormsIdentity = CType(User.Identity,
FormsIdentity)
Dim ticket As FormsAuthenticationTicket = id.Ticket
userData.Text = ticket.UserData
However, when I run this code I get an Invalid Cast
Exception on the first line.
I need to know how to make this type conversion work, why
it is not working, or just a workaround for this issue.
Thanks for any help,
David C. Taylor, MCP
- Next message: Alek Davis: "Re: Decrypt string encrypted with SHA1"
- Previous message: Redeye: "Re: User has to login twice. Why??"
- Next in thread: Joseph: "Re: Problem with Forms Authentication"
- Reply: Joseph: "Re: Problem with Forms Authentication"
- Reply: Tian Min Huang: "RE: Problem with Forms Authentication"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|