Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Difference between Asp.net SessionState and ViewState in C#, VB.NET

Nov 5, 2012
Introduction:

Here I will explain what is the difference between viewstate and sessionstate in asp.net using c#.net and vb.net.

Description:


      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.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

14 comments :

yes said...

Thanks...

Jagwinder Singh said...

What is difference between viewstate and hidden fields?

Manoj said...


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

Anonymous said...

In view state data are store in hidden field with hash format.
Where in hidden field data is not hash.

Saikat malakar

Anonymous said...

can we encrypt viewstate?

Parthi said...

very useful information suresh thanks ...

Parthi said...

very useful information suresh thanks ...

Anonymous said...

Hi Sures underlies how to save / add records with dropdownlist





STUDENT IDENTIFICATION


Date Of Birth>


Year


Month


Day








Anonymous said...

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

ANIL BABU Mandla said...

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?????

Mayur Sawant said...

using session state, can I retrieve the data of student from database??

Please update me.
Thanks in advance... :)

Anonymous said...

useful information

Anonymous said...

@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.

Anonymous said...

good...........

Give your Valuable Comments

Other Related Posts

© 2010-2012 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.