96,239 views 121 on YTPak
230 2

Published on 01 Dec 2012 | over 4 years ago

Link for csharp, asp.net , ado.net , dotnet basics, mvc and sql server video tutorial playlists

Different techniques to send data from one webform to another
1. Cross Page Postback: Discussed in Part 55 and Part 56
2. Context.Handler object - Discussed in Part 58
3. Query strings - Discussed in Part 59
4. Cookies - Discussed in Part 60 and Part 61
5. Session state - Will be discussed in this session

The following concepts will be discussed in the subsequent sessions
6. Application state

Just like Query strings, Session State variables can also be used to send data from one webform to another.

Points to remember about session state variables:
1. Session state variables are stored on the web server by default, and are kept for the life time of a session.

2. The default session state mode is InProc. We will discuss about different session state modes in a later video session.

3. The life time of a session is determined by the time-out value in web.config file. The default is 20 minutes. The time-out value can be adjusted according, to your application requirements.

4. Session state variables are available across all pages, but only for a given single session. Session variables are like single-user global data.

5. It is always a good practice to check, if a session state variable is null before calling any of its methods, such as ToString(). Otherwise, we may run into runtime NullReferenceExceptions.
if (Session["Name"] != null)
lblName.Text = Session["Name"].ToString();

6. Application performance can be improved by disabling session state, if it's not required. Session state can be turned off at the page or application level.
a)To turn of the session state at the page level, set EnableSessionState="False" in the page directive
b)To turn of the session state at the application level, set SessionState mode=false in web.config file.

Loading related videos...