.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> ASP.Net >> Post New Question Subscribe to Interview Questions

How to update and retrieve value from a session state object?

Posted By :Abhisek Panda     Posted Date :July 31, 2010    Points :10   Category :ASP.Net 
To add or update a session state item use the following syntax,
[CODE]Session["Item Name"]= value;[/CODE]
Ex:- [CODE]Session["Name"]= Abhisek;[/CODE]
You can also pass a variable.

To to retrieve a session state items value use following ,
[CODE]String name=Session["Name"].ToString();[/CODE]
You can also retrieve to other formats according the session state item's data.

You can also find related Interview Question to How to update and retrieve value from a session state object?  below: 

Session state vs View state

  
In some cases, using view state is not feasible. The alternative for view state is session state. Session state is employed under the following situations:
. Large amounts of data - View state tends to increase the size of both the HTML page sent to the browser and the size of form posted back. Hence session state is used.
. Secure data - Though the view state data is encoded and may be encrypted, it is better and secure if no sensitive data is sent to the client. Thus, session state is a more secure option.
. Problems in serializing of objects into view state - View state is efficient for a small set of data. Other types like DataSet are slower and can generate a very large view state (More...)

Which typically consumes more memory: application state or session state?

  
Session state tends to use much more memory than application state, because copies of all variables are stored for each user. (More...)

Which might not work if a user has disabled cookies in his or her Web browser: application state or session state?

  
Session state, by default, won't work if a Web browser that supports cookies has cookies disabled. Application state isn't user-specific, though, and doesn't need to be tracked in cookies. Therefore, application state works regardless of cookies. (More...)

Which typically consumes more memory: application state or session state?

  
Session state tends to use much more memory than application state, because copies of all variables are stored for each user. (More...)

Which might not work if a user has disabled cookies in his or her Web browser: application state or session state?

  
Session state, by default, won't work if a Web browser that supports cookies has cookies disabled. Application state isn't user-specific, though, and doesn't need to be tracked in cookies. Therefore, application state works regardless of cookies (More...)

Session state vs. View state:

  
In some cases, using view state is not feasible. The alternative for view state is session state. Session state is employed under the following situations:
o Large amounts of data - View state tends to increase the size of both the HTML page sent to the browser and the size of form posted back. Hence session state is used.
o Secure data - Though the view state data is encoded and may be encrypted, it is better and secure if no sensitive data is sent to the client. Thus, session state is a more secure option.
o Problems in serializing of objects into view state - View state is efficient for a small set of data. Other types like DataSet are slower and can generate a very large view state. (More...)

Where to Use Session object?

  
1) When you want to pass value/object to another page you can use this session object.

2) When you want to save (temporary) some data for that particular user , you can use this session object. Eg., Passing login information of the user from one page to another
(More...)

What do you mean by SESSION and APPLICATION object in asp.net?

  
Session object store information between HTTP requests for a individual user and application object are global across all users. (More...)

What do ypu mean by SESSION and APPLICATION object ?

  
Session object store information between HTTP requests for a particular user, while application object are global across users. (More...)

How to specify session state mode in ASP.NET ?

  
stateConnectionString="tcpip=192.168.100.100:420420"
sqlConnectionString="data source=192.168.100.100; Integrated
Security=SSPI"
cookieless="false"
timeout="20"
/> (More...)

How is form session state maintained in InfoPath?

  
Sql server database:this approach is termed as using session state services.
Asp.net view stored in clients side:Termed form view (More...)

What is Shrinking Session State in ASP.NET 4.0

  
In ASP.NET 4.0 we can compress session state data, for Session-state server
and Microsoft SQL server session mode, before serializing the session data so that network load to
transfer session data can be reduced.This can be done by setting the compressionEnable to true in
the web.config file as below:

mode="SqlServer"
sqlConnectionString="data source=Test;Initial Catalog=Test"
allowCustomSqlDatabase="true" compressionEnabled="true" /> (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend