473,385 Members | 2,274 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,385 software developers and data experts.

Can static varible cross session

ad

I define a static variable, like myClass.aString.
If one user in a session update the value of myClass.aString.
Can the other users in other sessions can see this change?
Nov 19 '05 #1
3 1149
Yes, static variables are shared throughout the application. It's like a
global variable in a sense that's simply contained within the class.

-Brock
DevelopMentor
http://staff.develop.com/ballen
I define a static variable, like myClass.aString.
If one user in a session update the value of myClass.aString.
Can the other users in other sessions can see this change?


Nov 19 '05 #2
Be carefull with synchronization - if you leave shared state unsynchronized
it's dangerous, if you synchrnonize it - it degrades performance and in the
worst case can result in a deadlock.
"Brock Allen" <ba****@develop.com.i_hate_spam_too> wrote in message
news:88*********************@msnews.microsoft.com. ..
Yes, static variables are shared throughout the application. It's like a
global variable in a sense that's simply contained within the class.

-Brock
DevelopMentor
http://staff.develop.com/ballen
I define a static variable, like myClass.aString.
If one user in a session update the value of myClass.aString.
Can the other users in other sessions can see this change?


Nov 19 '05 #3
In order to let other users to share data in same
application, you should use ApplicationState rather than
SessionState to store the data.

Elton Wang
el********@hotmail.com

-----Original Message-----

I define a static variable, like myClass.aString.
If one user in a session update the value of myClass.aString.Can the other users in other sessions can see this change?
.

Nov 19 '05 #4

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

Similar topics

2
by: Ryan Hubbard | last post by:
Could someone provide me with some code to hold an object reference in a static variable in a function. function a(&$t){ static $b; if(is_object($b)){ print "IN - $b->logfile"; } else {...
2
by: Jack | last post by:
Hello, Under is C procedure: #include<stdio.h> #include<conio.h> void ab(int x) { if(x<5) { ab(x+1); printf("%d ",x);
3
by: prash | last post by:
Hello all I have a strange problem at the moment .I use iis5 to do my asp pages with vb scripts when i set session("myvar")="anyvalue" in my first page i cannot read the session variable in...
0
by: farooq | last post by:
Hi guys, I’m facing some problem can u solve it. Problem is: I’m giving user Id and password in (Login_sess.asp) and submit it to page (sess_test.asp). I am setting session variable...
7
by: Drew McCormack | last post by:
I have a C++ template class which contains a static variable whose construction registers the class with a map. Something like this: template <typename T> class M { static Registrar<M>...
4
by: ad | last post by:
I define a static variable, like myClass.aString. If one user in a session update the value of myClass.aString. Can the other users in other sessions can see this change?
6
by: The8thSense | last post by:
how to declare static varible and static method inside a class ? i try "public static ABC as integer = 10" and it said my declaration is invalid Thanks
7
by: Stephen Poley | last post by:
I have the following situation: - a table of employees, keyed on employee-id; - a table of training sessions, keyed on session-id; - a requirement to log who was present at which session, plus...
6
by: Vladislav Kosev | last post by:
I have this strange problem now twice: I am writing this relatevely large web site on 2.0 and I made a static class, which I use for url encoding and deconding (for remapping purposes). This static...
7
by: reyesflaco | last post by:
I am developing an application using asp.net 2.0. I created all my business objects in my app_code folder. As of right now, all my classes are public. In my aspx pages, I am declaring the class...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...

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.