Session alternatives
- Cookies
- More scalable
- Free memory on server
- Persist. Does not delete after session expires.
- Mostly not enable in client browser
- More security risk than sessions it can be tracked by any virus. Use encrypted.
- Limited in size 4kb max
- Has to send to server with each request. Bandwidth cost increases.
- Can be delete by user/browser/any automated system. Limit is 20 cookies per domain.
- Querystring
- Cannot transfer lot of data
- Old asp way to communicate
- Security issue
- URL rewriting
- but it cannot be used for identification values or ids
- Viewstate
- Cannnot be used to communicate between pages.
- Hidden fields
- Cannnot be used to communicate between pages.
- Profile properties
- It also uses a session identifier along with database
- It remains after user leaves
- Similar as our tempt able but only difference is it is asp.net default mechanism
- Forms authentication with session id only and keep everything in the database.
- Scalable method
- By default store data in database.
- Data does not delete when session expires. Or web app restarted.
- Previous page directive. Or previous page references.
- This can be used only for postback urls changed to different url.
- A lot of code has to be written.
- Sessions
Cookies like sessions too, could be easily read. For sensitive information, better use Forms or Windows authentication. The most reliable way to keep user's information across sessions is to store them to database on server. You can do it manually, but it is usually more efficient to use Profile properties.
Profile properties also persist between sessions. Unlike cookies, data are stored on server side (in Sql Server database by default). Profile properties work with both authenticated and anonymous users and even support migrating of data when anonymous user log in.
No comments:
Post a Comment
Dear blog visitor, Thanks for visiting my blog.