• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

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 :-)
0
dingir
Asked:
dingir
2 Solutions
 
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
 
Kumaraswamy RCommented:
Hi

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

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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
 
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now