Persistent Forms Authentication - and Session Variables

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

Hi All!

I'm doing an ASP.NET project which uses Persistent Forms Authentication
(i.e. once user logged in, they don't have to log in again). However Session
variables are erased after Session has timed out. So I need to re-populate
user specific session variables (such as user email, DOB, Full Name...etc)
when Session has ended.

But strangely, when I tried to do something like....

Dim strArrayUserInfo(10) as String

strArrayUserInfo(0) = drDataReader("FName").ToString
strArrayUserInfo(1) = drDataReader("LName").ToString
strArrayUserInfo(2) = drDataReader("Email").ToString

Session("UserInfoArray") = strArrayUserInfo

I get System.StackOverflowException. If I comment out that line, application
runs correctly but fail at the point where Session("UserInfoArray") is
accessed (i.e. Null Exception). So I de-comment the above code and I was
thrown System.StackOverflowException again.

What could be the problem??? I was merely assigning a variable to Session
variable collection. Why ASP.NET throws System.StackOverflowException????

Thank you all in advance!!!!

Max
 
Max said:
Hi All!

I'm doing an ASP.NET project which uses Persistent Forms Authentication
(i.e. once user logged in, they don't have to log in again). However
Session variables are erased after Session has timed out. So I need to
re-populate user specific session variables (such as user email, DOB, Full
Name...etc) when Session has ended.

But strangely, when I tried to do something like....

Dim strArrayUserInfo(10) as String

strArrayUserInfo(0) = drDataReader("FName").ToString
strArrayUserInfo(1) = drDataReader("LName").ToString
strArrayUserInfo(2) = drDataReader("Email").ToString

Session("UserInfoArray") = strArrayUserInfo

I get System.StackOverflowException. If I comment out that line,
application runs correctly but fail at the point where
Session("UserInfoArray") is accessed (i.e. Null Exception). So I
de-comment the above code and I was thrown System.StackOverflowException
again.

What could be the problem??? I was merely assigning a variable to Session
variable collection. Why ASP.NET throws System.StackOverflowException????

I bet you have something else called "Session". Change the line to refer to
HttpContext.Current.Session and see if that's any better.

John Saunders
 
Hi John,

Thanks for the quick response! Unfortunately, I get the same error :(

Any ideas?

Max
 
Max said:
Hi John,

Thanks for the quick response! Unfortunately, I get the same error :(

Several ideas, none brilliant.

1) Simplify, simplify, simplify
1a) Instead of filling from the datareader, try setting the array elements
to constants. It's simpler.
1b) Try using Session("a"). It's simpler.
2) Are you setting all 10 elements of the array?
3) Turn Options Strict On.

John Saunders
 
Hi John,

I tried reducing the Array length to 3 and still it didn't work. This is a
mystery and a nightmare.

Max
 
Max said:
Hi John,

I tried reducing the Array length to 3 and still it didn't work. This is a
mystery and a nightmare.

Did you try using an array filled with constants? Did you try using
Session("a")? Have you turned Options Strict On?

John Saunders
 
Back
Top