Introduction:
Here I will explain what is the difference between viewstate and sessionstate in asp.net using c#.net and vb.net.
Description:
In
previous posts I explained convert.tostring() VS .tostring(), web application VS website, difference between datareader,
dataadapter and dataset, difference between tinyint, smallint,
int, bigint
and many articles relating to asp.net, SQL
Server.
Now I will explain the difference between viewstate and sessionstate in asp.net
using c#.net and vb.net.
View State:
- View state is maintained in page level only.
- View state of one page is not visible in another page.
- View state information stored in client only.
- View state persist the values of particular page in the client (browser) when post back operation done.
- View state used to persist page-instance-specific data. (Read more)
Session State:
- Session state is maintained in session level.
- Session state value is available in all pages within a user session.
- Session state information stored in server.
- Session state persist the data of particular user in the server. This data available till user close the browser or session time completes.
- Session state used to persist the user-specific data on the server side. (Read more)
Usage
- If you want to access the information on different web pages, you can use SessionState
- If you want to access from the same
page, then you can use Viewstate
Security
Session state provides more security when
compared with view state as the data value is stored in server side
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
17 comments :
Thanks...
What is difference between viewstate and hidden fields?
Hii Jagwinder Singh,
Here is Your Answer
ViewState stores information in the Web page using hidden fields. Hidden fields are sent back to the server when the user submits a form
In view state data are store in hidden field with hash format.
Where in hidden field data is not hash.
Saikat malakar
can we encrypt viewstate?
very useful information suresh thanks ...
very useful information suresh thanks ...
Hi Sures underlies how to save / add records with dropdownlist
STUDENT IDENTIFICATION
Date Of Birth>
Year
Month
Day
Hi Sures underlies how to save / add records with dropdownlist
STUDENT IDENTIFICATION
Date Of Birth
DropDownList ID="DropDownList1" runat="server"
asp:ListItem Year asp:ListItem
DropDownList DropDownList ID="DropDownList2" runat="server"
asp:ListItem Month ListItem
DropDownList :DropDownList ID="DropDownList3" runat="server"
asp:ListItem Day asp:ListItem
:DropDownList
asp:Button ID="Button1" runat="server" Text="Save
Thank you,I am running the project immoderately asking userid and pwd i am enter the details its checking backed database it's correct disply that corresponding some another page,it's wrong display error msg.
My question is ia m running the first time asking login details ok,I am running second time not asking again login details automatically display that corresponding page,
can you give me one simple example on this plz help me what concept is involved to do this?????
using session state, can I retrieve the data of student from database??
Please update me.
Thanks in advance... :)
useful information
@Mayur Sawant :
You have to pass student Id or other unique identification as you store in session and retrive student info through inline query or sp.
good...........
short and simple explanation
nice
where the session and view state variable store in asp.net?
Note: Only a member of this blog may post a comment.