Best Practice store visitor session outside login

How do I best store a visitors session when it's not logged in? SessionID is cleared out everytime.. Cookies works but has it's drawbacks also.. global.asax and a created guid to use for so long the user are still on the page.. some ideas is of help :-)
LVL 1
dingirAsked:
Who is Participating?
 
Jon500Commented:
Be careful about persisting state in static class properties or in the Session object. If you ever need to scale your web server to more than one box, you're going to find that your solution will not scale. Hence, the querystring value (which does scale properly to any load-balanced server).

Regards,
Jon500
0
 
Jon500Commented:
One "best practice" option is to place the sesionid in the URL as a querystring value. You can always encode this value for added security.

Regards,
Jon500

0
 
zadeveloperCommented:
something else you could try is adding a static class to your website. You can set the values in there and they stay for the duration of the users session.


No need to worry about sessions cookies etc - data will be stored on the server side.

public static class MyDataContext
{
    public static string TempUserName {get;set;}


...


//Im sure you get the idea
}


then from your pages/ classes etc ....

MyDataContext.TempUserName = "abcde";

and from another page go

lblTempName.Text= MyDataContext.TempUserName;

Open in new window

0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
Kumaraswamy RCommented:
Hi

My Suggestion is :
Storing in the Data Base Table and retrieve from Require Information(while launching the Next Time)

0
 
zadeveloperCommented:
but if he is not identified (and knowing that ip addresses on ADSL fluctuate)  how would he retrieve the data ? - He would still need to use a cookie.
0
 
zadeveloperCommented:
very good point.
0
 
dingirAuthor Commented:
Thank's that interesting iformation. I do store a sessionobject in database and update it with customerid on login. Starting the session in global.asax session_start
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.