473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Session and View State variables

Could someone enlighten me what the difference between viewstate[" and
session[" variables in terms of use, performance, and rule of thumb, from
what I understand viewstate has overhead to it, and is passed with the page
encrypted where session is stored locally in the aspnet_wp.exe process.

Also, how do class member variables fit in the mix?
Nov 18 '05 #1
4 3165
Viewstate variables are stored in the HTML of your page. They are encoded
so they are not easily readable, but they are not encrypted. This is
generally the best scope to use when you have a variable that is valid for a
particular page and you want to store the value between postbacks. Once the
user navigates to another page the value is lost.

Session variables are stored on the server (in RAM by default) and are
persisted between all pages.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"John Smith Jr." <me@isp.com> wrote in message
news:eX*************@tk2msftngp13.phx.gbl...
Could someone enlighten me what the difference between viewstate[" and
session[" variables in terms of use, performance, and rule of thumb, from
what I understand viewstate has overhead to it, and is passed with the page encrypted where session is stored locally in the aspnet_wp.exe process.

Also, how do class member variables fit in the mix?

Nov 18 '05 #2
Thank you, very clear answer.

How about class variables to the page, I understand they are only available
for that page, and not the application, but are those sent with postback or
they handled on the server in ram only?
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Viewstate variables are stored in the HTML of your page. They are encoded
so they are not easily readable, but they are not encrypted. This is
generally the best scope to use when you have a variable that is valid for a particular page and you want to store the value between postbacks. Once the user navigates to another page the value is lost.

Session variables are stored on the server (in RAM by default) and are
persisted between all pages.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"John Smith Jr." <me@isp.com> wrote in message
news:eX*************@tk2msftngp13.phx.gbl...
Could someone enlighten me what the difference between viewstate[" and
session[" variables in terms of use, performance, and rule of thumb, from what I understand viewstate has overhead to it, and is passed with the

page
encrypted where session is stored locally in the aspnet_wp.exe process.

Also, how do class member variables fit in the mix?


Nov 18 '05 #3
if the member variable is a web control then the state is passed along in
the ViewState
from which it is retrieved and restored on postback.
Ordinary variables are not persisted @(Since the instance of the page class
running is discarded once processing is finished)

If you want to persist you own set of variables... either add and retrieve
them from view state or the session

Hope this help

HD

"John Smith Jr." <me@isp.com> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl...
Thank you, very clear answer.

How about class variables to the page, I understand they are only available for that page, and not the application, but are those sent with postback or they handled on the server in ram only?
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Viewstate variables are stored in the HTML of your page. They are encoded
so they are not easily readable, but they are not encrypted. This is
generally the best scope to use when you have a variable that is valid
for a
particular page and you want to store the value between postbacks. Once

the
user navigates to another page the value is lost.

Session variables are stored on the server (in RAM by default) and are
persisted between all pages.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"John Smith Jr." <me@isp.com> wrote in message
news:eX*************@tk2msftngp13.phx.gbl...
Could someone enlighten me what the difference between viewstate[" and
session[" variables in terms of use, performance, and rule of thumb,

from what I understand viewstate has overhead to it, and is passed with the

page
encrypted where session is stored locally in the aspnet_wp.exe process.
Also, how do class member variables fit in the mix?



Nov 18 '05 #4
Ahh, thank you much.
"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:eq**************@TK2MSFTNGP10.phx.gbl...
if the member variable is a web control then the state is passed along in
the ViewState
from which it is retrieved and restored on postback.
Ordinary variables are not persisted @(Since the instance of the page class running is discarded once processing is finished)

If you want to persist you own set of variables... either add and retrieve
them from view state or the session

Hope this help

HD

"John Smith Jr." <me@isp.com> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl...
Thank you, very clear answer.

How about class variables to the page, I understand they are only

available
for that page, and not the application, but are those sent with postback

or
they handled on the server in ram only?
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Viewstate variables are stored in the HTML of your page. They are encoded so they are not easily readable, but they are not encrypted. This is
generally the best scope to use when you have a variable that is valid for
a
particular page and you want to store the value between postbacks. Once
the
user navigates to another page the value is lost.

Session variables are stored on the server (in RAM by default) and are
persisted between all pages.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"John Smith Jr." <me@isp.com> wrote in message
news:eX*************@tk2msftngp13.phx.gbl...
> Could someone enlighten me what the difference between viewstate["
and > session[" variables in terms of use, performance, and rule of thumb, from
> what I understand viewstate has overhead to it, and is passed with

the page
> encrypted where session is stored locally in the aspnet_wp.exe

process. >
> Also, how do class member variables fit in the mix?
>
>



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: P. Glassel | last post by:
I'm having problems getting session timeouts to change programmaticlaly under IIS6.0. This is unchanged code that ran as expected under IIS5.0. Anyone else run into this problem? Thx.
5
by: Phil Grimpo | last post by:
I have a very odd situation here. I have an administration page, where based on a users permissions, a recordset is called from the SQL server which has a list of paths to "Module Menus". Each of...
5
by: Pross | last post by:
I've got an ASP.NET application and I need some information on every page like the user's name as well as a collection listing which sections of the application the user has access to. I could...
1
by: Wiktor Zychla | last post by:
Hello there, I've just encountered a strange problem with Session. In one particular scenario it is cleared between pages but the scenario is so specific that I am really, really startled. I've...
5
by: Oleg Ogurok | last post by:
Hi all, Is there a way to read other people's session variables? I understand it makes sense that session state is on per-user basis, but still... Is there a way to get a collection of all...
10
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much...
18
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
6
by: DNB | last post by:
I would like to know what you guys think is the best way to access data: Asp.Net session vs. Database Queries. In our application we are using asp.net tree view to display hierarchical data and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.