Persistent Forms Authentication - and Session Variables

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
 
J

John Saunders

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
 
M

Max

Hi John,

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

Any ideas?

Max
 
J

John Saunders

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
 
M

Max

Hi John,

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

Max
 
J

John Saunders

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top