473,396 Members | 1,846 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,396 software developers and data experts.

Variable values collision in multiuser environment

I had the idea that two users code are being run by two different
instancies, so from the variable values point of view they are
complete independent.

I have an asp.net that calls a module rutine.

When there are two users accessing to the module rutine, looks like
asp.net is sharing variable values. For example, in one point I check
the size of the table (from debug for example I now is 3) but is
reporting an incorrect size (let says 5 that comes from the table of
the second user).

The question I am not sure if this is wad or I am doing something
wrong.

Thanks in advance...
Nov 18 '05 #1
5 1767
"Manuel Arroba" <ma*****@yahoo.com> wrote in message
news:f4**************************@posting.google.c om...
I had the idea that two users code are being run by two different
instancies, so from the variable values point of view they are
complete independent.

I have an asp.net that calls a module rutine.

When there are two users accessing to the module rutine, looks like
asp.net is sharing variable values. For example, in one point I check
the size of the table (from debug for example I now is 3) but is
reporting an incorrect size (let says 5 that comes from the table of
the second user).

The question I am not sure if this is wad or I am doing something
wrong.


One thing you're doing wrong is not giving us much detail. :-)

Where are the variables you believe are being shared? I bet they are
module-level variables, in which case they will be shared, as there is only
one instance of the module, not one per page request.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2
Hi John thank you very much for your answer...

I did not post any code because I think it was a general question.

I have a page that is calling a rutine in a module file (.vb).

Public Structure DatosRutaConDatos
Public TodoOk As Boolean
Public tabla As DataTable
Public TextoError As String
End Structure
Module RutinasSincronizacion
Dim InstanciaDatosRuta As New DatosRuta()
Public Function BuscaInfo(ByVal tb As DataTable, ByVal Centro As
String) As DatosRutaConDatos
....
end function
...
end module
The problem arises when two users (two pages) call the same rutine
(BuscaInfo) at the same time. Some variables look that are not shared,
but I have problems with the InstanciaDatosRuta.

I had the idea that any code should not be shared.

Does it mean that we cannot use modules files ?... it looks a bit
strange.

Would you mind to confirm this point ?...
Thanks again... have a nice day
Manuel Arroba
Nov 18 '05 #3
"Manuel Arroba" <ma*****@yahoo.com> wrote in message
news:f4**************************@posting.google.c om...
Hi John thank you very much for your answer...

I did not post any code because I think it was a general question.

I have a page that is calling a rutine in a module file (.vb).

Public Structure DatosRutaConDatos
Public TodoOk As Boolean
Public tabla As DataTable
Public TextoError As String
End Structure
Module RutinasSincronizacion
Dim InstanciaDatosRuta As New DatosRuta()
Public Function BuscaInfo(ByVal tb As DataTable, ByVal Centro As
String) As DatosRutaConDatos
...
end function
..
end module
The problem arises when two users (two pages) call the same rutine
(BuscaInfo) at the same time. Some variables look that are not shared,
but I have problems with the InstanciaDatosRuta.

I had the idea that any code should not be shared.

Does it mean that we cannot use modules files ?... it looks a bit
strange.


Manuel, InstanciaDatosRuta will be shared by all users of the module. What
would have caused a new copy of InstanciaDatosRuta to be created?

You should probably avoid modules when working in VB.NET. They are a pre-OO
construct.

If you want a separate instance of InstanciaDatosRuta to exist per user,
then you're going to have to explicitly create the separate instance
somehow. For instance:

Public Structure DatosRutaConDatos
Public TodoOk As Boolean
Public tabla As DataTable
Public TextoError As String
End Structure
Public Class RutinasSincronizacion
Private InstanciaDatosRuta As New DatosRuta()
Public Function BuscaInfo(ByVal tb As DataTable, ByVal Centro As
String) As DatosRutaConDatos
....
end function
...
End Class
You will need to have some piece of code create an instance of the class
RutinasSincronizacion. Perhaps such an instance would be stored in Session:

If Session("RutinasSincronizacion") Is Nothing Then
Session("RutinasSincronizacion") = New RutinasSincronizacion()
End If

Dim RS As RutinasSincronizacion =
DirectCast(Session("RutinasSincronizacion"), RutinasSincronizacion)

Dim DRCD As DatosRutaConDatos = RS.BuscaInfo(tb, "centro")
--
John Saunders
johnwsaundersiii at hotmail

P.S. Please pardon my high-school Spanish, but what's a "Ruta"?
Nov 18 '05 #4
Hi John, thanks for you answer and your code sugestion..

I only can help you with you spanish.. :-)

Ruta is like "path". In this case is the path that follow some
products in a factory...

Thanks again, and have a nice day...
Nov 18 '05 #5
"Manuel Arroba" <ma*****@yahoo.com> wrote in message
news:f4*************************@posting.google.co m...
Hi John, thanks for you answer and your code sugestion..

I only can help you with you spanish.. :-)

Ruta is like "path". In this case is the path that follow some
products in a factory...


Thanks, this shows I'm getting old. I used to know "ruta" (which is akin to
"route" in English).
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #6

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

Similar topics

8
by: sebastien.hugues | last post by:
Hi I would like to retrieve the application data directory path of the logged user on windows XP. To achieve this goal i use the environment variable APPDATA. The logged user has this name:...
4
by: Pablo | last post by:
At my current job I've been tasked with maintaining a very old C++ application written largely in ANSI c++ in what I believe to be with an old DOS based Borland compiler. I'm trying to add a...
1
by: Bonj | last post by:
Hi My application installs a front-end GUI, which runs code when buttons are clicked. It also installs a command-line utility, that is a console application. They are both installed to the...
5
by: ton | last post by:
Hi, I keep several variables in a statevalue like: Dim session As SessionState.HttpSessionState = System.Web.HttpContext.Current.Session session("connect") = " FKHFSF " I thought that these...
7
by: jmar | last post by:
I'm hoping someone out there can give me a little guidance. I have an Access Database "Customer.MDB" with a table "CustInfo" that has the following design: Field: DataType CustID AutoNumber...
4
by: Neo Geshel | last post by:
I am experiencing a collision between two scripts, but I cannot find where it is. I am hoping that someone here can help me. I have two external JS files that I call into each web page. One...
4
by: sumansengupta | last post by:
I created an access in access2003 , its being used in multiuser environment ..based on a particular value the database is automatically closed and only i can change the value. Even after the...
1
by: Mike TI | last post by:
April 25, 2008 Hi all (VB Net 2008) I am populating a grid through a dataset. Now in a multiuser environment how do I show records added and updated by others. Do I have to fill the grid...
0
by: raamay | last post by:
I am new to VB.Net but since i have a good experience in VB6(having developed 2 to 3 desktop applications), i find no problem coping with the new environment at this stage. Well, i am planning to...
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: 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
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...

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.