Session Cookie Problem with some users

J

Jack Bhanded

Hi Friends,

Some of our visitors have problem logging in due to session cookie
problems. They can login successfully only after 2nd attempt. This
problem does not happen in all the browsers.

Any one has idea / suggestions about browsers that do not handle
session cookies properly with asp.net/iis6?

A Hint! The complaint from users has reduced a lot after we ported the
application from asp to asp.net. I am using custom authentication for
the login script and depending on the session value for authenticating
the users.

Thanks in Advance,
Jack.
 
S

Scott M.

The clients may not have session cookies enabled. It's generally not a good
idea to use sessions for mission-critical functionality. Use a database
instead. Databases can't be turned off by the client, work much better in a
web farm scenario (scalability) and you don't run the risk of losing any
data should one server go down.
 
J

Jack Bhanded

Thank you Scott!

I have just one ID to pass around in the session variable to determine
which user is browsing the pages and if there is no session value
present, redirect the user to login page. Can you please give me some
lead how I can easily change this to maintain session state through
database?

Regards,
Jack.
 
S

Scott M.

As the user successfully logs in, write that user's name/id into a database
table that represents active users. The primary key of this table will act
as the session id for that user. Take this primary key value and write it
into something like viewstate (so that it can be retrieved on other pages).
On the other pages that you would normally be checking to see if the session
data exists, look for your viewstate value. If it's there, the user is
logged in, if it isn't, redirect them.
 

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

Top