Subject: Maintaining state information across applications
Posted By: afroblanca Post Date: 1/10/2006 7:06:11 PM
Question #1 : I'm trying to maintain a user's state information (name, birthdate, zipcode, etc.) across applications and pageloads.  

What I've been doing thus far:
1) When a user logs in, generate a sessionId.
2) Store the sessionId in a database table along with the user's userId
3) Set a cookie with the user's sessionId
4) When an application loads, read the cookie, get the userId, and load the user's state information
5) Store the user's state information in ViewState

Steps 4 and 5 must be repeated every time a user loads a new application.  This causes a lot of DB accessing and does not maintain the user's state across applications.  It also slows down pageloads due to high ViewState content.  Is there a better way to do this?  How do the "big sites" accomplish what I'm trying to do?

Question #2 : I'm trying to share site configuration data (siteName, siteId, root url, etc.) between different applications on a given website.  What is the best way to do this that doesn't involve files, database tables, or querystring arguments?  

I've considered using cookies to solve both Questions #1 and #2, but this seems risky and unreliable.

Thanks for your help.
Reply By: planoie Reply Date: 1/13/2006 4:21:56 PM
Well, the ways you don't want to use are how the "big sites do it".  They probably have their own state management systems that involve databases.  When you start to cross between different applications, you'll need some form of persistant medium to store the information with unique identifiers to access it.

Cookies would be reliable but like you say, could be risky depending on the content as they are transmitted as plain text over HTTP.

-Peter

Go to topic 37613

Return to index page 396
Return to index page 395
Return to index page 394
Return to index page 393
Return to index page 392
Return to index page 391
Return to index page 390
Return to index page 389
Return to index page 388
Return to index page 387