473,662 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3177
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******** *****@tk2msftng p13.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.ne t> wrote in message
news:%2******** ********@tk2msf tngp13.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******** *****@tk2msftng p13.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******** ******@TK2MSFTN GP12.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.ne t> wrote in message
news:%2******** ********@tk2msf tngp13.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******** *****@tk2msftng p13.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******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP12.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.ne t> wrote in message
news:%2******** ********@tk2msf tngp13.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******** *****@tk2msftng p13.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
21108
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
3647
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 these menus are then placed into the page by calling Server.Execute(rs_Modules("ModulePath")). This works fine for up to 15 "menus" After that, the session variables that were set (not including those called by Global.ASA) are no longer set. ...
5
2000
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 store the user name in a regular session variable but the collection varies in size based on the user and could grow in the future as the application grows. I don't want to keep going back to the database for this info every time because it's needed...
1
2089
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 tried to look for similar situations in the group archive and it seems that few people have observed similar behaviour. None of them, however, got a clear explanation that would correspond to my problem. In my web application I put some...
5
2441
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 current HttpSessionState objects on the server, or at least get a reference to a HttpSessionState objects by session ID ? Thanks.
10
3500
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 more time I have on a session? If I do a refresh, does reset the session clock? Do you have have to go to another page to reset the session timeout or will a postback also do it? This is important as we have a few pages that a user
18
3432
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 File-New-Window creates an instance of IE in the same process with the same SessionID as the parent window is in big trouble. This fundamentally restricts the usefullness of using session state management. I probably missed it somewhere - can...
6
2435
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 when user clicks on particular node it brings up totally different page with all the asp.net controls dynamically generated. Example: Tree view Control is as follow:
0
8856
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8762
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7365
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.