473,407 Members | 2,629 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.

Preferred Method To Assign Session Variable Values

All -

Is there a preferred method to assign session variables in ASP.NET /
VB.NET?

It looks like you can do any of the following to assign values:

Session.Item("Foo") = "Bar"
Session("Foo") = "Bar"
Sesssion.Add("Foo", "Bar")

It looks like you can do either of the following to get values:

strBar = Session.Item("Foo")
strBar = Session("Foo")

Are there advantages/disadvantages to any of these approaches or do
they all get you the same thing?

Thanks,

- Matt

Nov 19 '05 #1
1 1398
They're all fine.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Matt" <ms******@ncen.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
All -

Is there a preferred method to assign session variables in ASP.NET /
VB.NET?

It looks like you can do any of the following to assign values:

Session.Item("Foo") = "Bar"
Session("Foo") = "Bar"
Sesssion.Add("Foo", "Bar")

It looks like you can do either of the following to get values:

strBar = Session.Item("Foo")
strBar = Session("Foo")

Are there advantages/disadvantages to any of these approaches or do
they all get you the same thing?

Thanks,

- Matt

Nov 19 '05 #2

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

Similar topics

15
by: Thomas Scheiderich | last post by:
I am trying to understand Session variables and ran into a question on how they work with data that is passed. I have an HTM file that calls an ASP file and sends the name either by GET or POST....
2
by: spiderman | last post by:
How can one 'assign' value of a session variable to a variable, something like: temp = session("variable") Thanks
6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
5
by: Rod | last post by:
I've written 2 ASP.NET applications (I've worked on one with a team and another by myself). In my ASP.NET pages, when saving data to a backend database I've done it by using the click event of a...
3
by: Jesper Pedersen | last post by:
This works fine: <% Session=1; %> but this: <% Session=%> <%# DataBinder.Eval(Container.DataItem, "playerID") %> <%; %> do not work. The playerID contains the value 1, so the values in both...
14
by: Coleen | last post by:
Hi All :-) We have an APSX application using VB.net as the code behind, which uses one or two session variables per page. These Session variables are passed to the final page and calculations...
4
by: philin007 | last post by:
Hi , I have the following javascript codes: ****************************************** <script language="JavaScript"> <!-- .... ..... if (nextRow >5) {
12
by: Kurda Yon | last post by:
I am wandering which way to assign a value to a session variable exist. Which of the following examples will work. Example #1: session_start(); session_register("ex"); $ex = 2.0; Example...
2
by: rahullko05 | last post by:
i am stuck in the problem, where after user logs in successfuly, i take him to the login thanks page. now on that page i need to retain the login name. I am not sure how to this. i have written a...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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,...
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...

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.