473,473 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VERY IMPORTANT: Sharing

Hello All

I have developed a new site using ASP.NET/VB.NET. I fell into a big problem. Here is the problem

I created a module as follow

Namespace FinancialCompany.Porta
Public Class myPropertie
Private _intCounter As System.Int3

Public Property intCounter() As System.Int3
Ge
Return _intCounter
End Ge
Set(ByVal Value As System.Int32
_intCounter = Valu
End Se
End Propert
End Class
End Namespac

Now I use this in an ASP.NET page as follow

Imports FinancialCompany.Portal.myPropertie

Namespace FinancialCompany.Porta
Public Class _defaul
Inherits System.Web.UI.Pag

Private m_test As System.Int32 = Resquest.QueryString("TEST"

Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs)
If Not Page.IsPostback Then
If m_test = 0 Then intCounter += 0
If m_test = 1 Then intCounter += 1
If m_test = 2 Then intCounter +=

Response.Write("Here is the result: " + CStr(m_test)
End If
End Sub
End Clas
End Namespac

Now when I tested this with two to five users with the following URLs

User 1: http://localhost/myproject/default.aspx?TEST=
User 2: http://localhost/myproject/default.aspx?TEST=
User 3: http://localhost/myproject/default.aspx?TEST=

If user 2 clicks the URL he gets
Here is the result:

But if user 3 cllicks the URL he gets
Here is the result:
instead of
Here is the result:

Hence the intCount property remains active for every users!!! I expect it to be a different instance for each different users

How come is it being shared??

I am using Windows 2000 Server, ASP.NET 2003, & Framework 1.

Hope someone can help me... Should I simply just use Session("intCount") instead or even Application("intCounter")

I really need to understand why the hack is intCounter being stored in memory...

Thanks

Yam

Nov 18 '05 #1
6 1134
Not sure this is your problem, but I noticed a typo:

Private m_test As System.Int32 = Resquest.QueryString("TEST")

Should be Request

"Yama" <an*******@discussions.microsoft.com> wrote in message
news:52**********************************@microsof t.com...
Hello All,

I have developed a new site using ASP.NET/VB.NET. I fell into a big
problem. Here is the problem:

I created a module as follow:

Namespace FinancialCompany.Portal
Public Class myProperties
Private _intCounter As System.Int32

Public Property intCounter() As System.Int32
Get
Return _intCounter
End Get
Set(ByVal Value As System.Int32)
_intCounter = Value
End Set
End Property
End Classs
End Namespace
Now I use this in an ASP.NET page as follow:

Imports FinancialCompany.Portal.myProperties

Namespace FinancialCompany.Portal
Public Class _default
Inherits System.Web.UI.Page

Private m_test As System.Int32 = Resquest.QueryString("TEST")

Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs)
If Not Page.IsPostback Then
If m_test = 0 Then intCounter += 0
If m_test = 1 Then intCounter += 1
If m_test = 2 Then intCounter += 2

Response.Write("Here is the result: " + CStr(m_test))
End If
End Sub
End Class
End Namespace

Now when I tested this with two to five users with the following URLs:

User 1: http://localhost/myproject/default.aspx?TEST=0
User 2: http://localhost/myproject/default.aspx?TEST=1
User 3: http://localhost/myproject/default.aspx?TEST=2

If user 2 clicks the URL he gets:
Here is the result: 1

But if user 3 cllicks the URL he gets:
Here is the result: 3
instead of:
Here is the result: 2

Hence the intCount property remains active for every users!!! I expect it
to be a different instance for each different users.

How come is it being shared???

I am using Windows 2000 Server, ASP.NET 2003, & Framework 1.1

Hope someone can help me... Should I simply just use Session("intCount")
instead or even Application("intCounter")?

I really need to understand why the hack is intCounter being stored in
memory...

Thanks,

Yama


Nov 18 '05 #2
Hi Ken

Thanks for correcting the typo. I typed an demo program to present my case... :-) Sorry for the typo

The bug is that two different user can share the same session. So for instance
--- if I am userA on computer
--- and you are userB on computer
--- if userA is viewing ReportA
--- then userB although trying to view ReportB will see ReportA...

I have report name as a string property called strReportName that keeps track (kinda like a session variable) of the report name. But when userA selects the report userB will share that report name..

Hopefully that is a little more self-explanatory

Yama Kamya
----- Ken Cox [Microsoft MVP] wrote: ----

Not sure this is your problem, but I noticed a typo

Private m_test As System.Int32 = Resquest.QueryString("TEST"

Should be Reques

"Yama" <an*******@discussions.microsoft.com> wrote in message
news:52**********************************@microsof t.com..
Hello All
I have developed a new site using ASP.NET/VB.NET. I fell into a big

problem. Here is the problem
I created a module as follow
Namespace FinancialCompany.Porta

Public Class myPropertie
Private _intCounter As System.Int3
Public Property intCounter() As System.Int3

Ge
Return _intCounte
End Ge
Set(ByVal Value As System.Int32
_intCounter = Valu
End Se
End Propert
End Class
End Namespac
Now I use this in an ASP.NET page as follow

Imports FinancialCompany.Portal.myPropertie
Namespace FinancialCompany.Porta

Public Class _defaul
Inherits System.Web.UI.Pag
Private m_test As System.Int32 = Resquest.QueryString("TEST"
Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs

If Not Page.IsPostback The
If m_test = 0 Then intCounter +=
If m_test = 1 Then intCounter +=
If m_test = 2 Then intCounter +=
Response.Write("Here is the result: " + CStr(m_test)

End I
End Su
End Clas
End Namespac
Now when I tested this with two to five users with the following URLs
User 1: http://localhost/myproject/default.aspx?TEST=

User 2: http://localhost/myproject/default.aspx?TEST=
User 3: http://localhost/myproject/default.aspx?TEST=
If user 2 clicks the URL he gets

Here is the result:
But if user 3 cllicks the URL he gets

Here is the result:
instead of
Here is the result:
Hence the intCount property remains active for every users!!! I expect it

to be a different instance for each different users
How come is it being shared??
I am using Windows 2000 Server, ASP.NET 2003, & Framework 1.
Hope someone can help me... Should I simply just use Session("intCount")

instead or even Application("intCounter")
I really need to understand why the hack is intCounter being stored in

memory..
Thanks
Yam

Nov 18 '05 #3
Hi

Actually the component code should be

myModule.vb code
Namespace FinancialCompany.Porta
Public Module myModul
Public Class myPropertie
Private _intCounter As System.Int3

Public Property intCounter() As System.Int3
Ge
Return _intCounter
End Ge
Set(ByVal Value As System.Int32
_intCounter = Valu
End Se
End Propert
End Class
End Modul
End Namespac

default.aspx code
Imports FinancialCompany.Portal.myModule.myPropertie

Namespace FinancialCompany.Porta
Public Class _defaul
Inherits System.Web.UI.Pag

Private m_test As System.Int32 = Request.QueryString("TEST"

Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs)
If Not Page.IsPostback Then
If m_test = 0 Then intCounter += 0
If m_test = 1 Then intCounter += 1
If m_test = 2 Then intCounter +=

Response.Write("Here is the result: " + CStr(m_test)
End If
End Sub
End Clas
End Namespac
Yama Kamya

----- Yama wrote: ----

Hello All

I have developed a new site using ASP.NET/VB.NET. I fell into a big problem. Here is the problem

I created a module as follow

Namespace FinancialCompany.Porta
Public Class myPropertie
Private _intCounter As System.Int3

Public Property intCounter() As System.Int3
Ge
Return _intCounter
End Ge
Set(ByVal Value As System.Int32
_intCounter = Valu
End Se
End Propert
End Class
End Namespac
Now I use this in an ASP.NET page as follow

Imports FinancialCompany.Portal.myPropertie

Namespace FinancialCompany.Porta
Public Class _defaul
Inherits System.Web.UI.Pag

Private m_test As System.Int32 = Resquest.QueryString("TEST"

Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs)
If Not Page.IsPostback Then
If m_test = 0 Then intCounter += 0
If m_test = 1 Then intCounter += 1
If m_test = 2 Then intCounter +=

Response.Write("Here is the result: " + CStr(m_test)
End If
End Sub
End Clas
End Namespac

Now when I tested this with two to five users with the following URLs

User 1: http://localhost/myproject/default.aspx?TEST=
User 2: http://localhost/myproject/default.aspx?TEST=
User 3: http://localhost/myproject/default.aspx?TEST=

If user 2 clicks the URL he gets
Here is the result:

But if user 3 cllicks the URL he gets
Here is the result:
instead of
Here is the result:

Hence the intCount property remains active for every users!!! I expect it to be a different instance for each different users

How come is it being shared??

I am using Windows 2000 Server, ASP.NET 2003, & Framework 1.

Hope someone can help me... Should I simply just use Session("intCount") instead or even Application("intCounter")

I really need to understand why the hack is intCounter being stored in memory...

Thanks

Yam

Nov 18 '05 #4
Maybe this will help.
Modules are a reference type similar to classes, but with some important
distinctions. The members of a module are implicitly Shared and scoped to
the declaration space of the standard module's containing namespace, rather
than just to the module itself. Unlike classes, modules can never be
instantiated, do not support inheritance, and cannot implement interfaces.

"Yama" <an*******@discussions.microsoft.com> wrote in message
news:51**********************************@microsof t.com...
Hi,

Actually the component code should be:

myModule.vb code:
Namespace FinancialCompany.Portal
Public Module myModule
Public Class myProperties
Private _intCounter As System.Int32

Public Property intCounter() As System.Int32
Get
Return _intCounter
End Get
Set(ByVal Value As System.Int32)
_intCounter = Value
End Set
End Property
End Classs
End Module
End Namespace

default.aspx code:
Imports FinancialCompany.Portal.myModule.myProperties

Namespace FinancialCompany.Portal
Public Class _default
Inherits System.Web.UI.Page

Private m_test As System.Int32 = Request.QueryString("TEST")

Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs) If Not Page.IsPostback Then
If m_test = 0 Then intCounter += 0
If m_test = 1 Then intCounter += 1
If m_test = 2 Then intCounter += 2

Response.Write("Here is the result: " + CStr(m_test))
End If
End Sub
End Class
End Namespace
Yama Kamyar

----- Yama wrote: -----

Hello All,

I have developed a new site using ASP.NET/VB.NET. I fell into a big problem. Here is the problem:
I created a module as follow:

Namespace FinancialCompany.Portal
Public Class myProperties
Private _intCounter As System.Int32

Public Property intCounter() As System.Int32
Get
Return _intCounter
End Get
Set(ByVal Value As System.Int32)
_intCounter = Value
End Set
End Property
End Classs
End Namespace
Now I use this in an ASP.NET page as follow:

Imports FinancialCompany.Portal.myProperties

Namespace FinancialCompany.Portal
Public Class _default
Inherits System.Web.UI.Page

Private m_test As System.Int32 = Resquest.QueryString("TEST")

Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs) If Not Page.IsPostback Then
If m_test = 0 Then intCounter += 0
If m_test = 1 Then intCounter += 1
If m_test = 2 Then intCounter += 2

Response.Write("Here is the result: " + CStr(m_test))
End If
End Sub
End Class
End Namespace

Now when I tested this with two to five users with the following URLs:
User 1: http://localhost/myproject/default.aspx?TEST=0
User 2: http://localhost/myproject/default.aspx?TEST=1
User 3: http://localhost/myproject/default.aspx?TEST=2

If user 2 clicks the URL he gets:
Here is the result: 1

But if user 3 cllicks the URL he gets:
Here is the result: 3
instead of:
Here is the result: 2

Hence the intCount property remains active for every users!!! I expect it to be a different instance for each different users.
How come is it being shared???

I am using Windows 2000 Server, ASP.NET 2003, & Framework 1.1

Hope someone can help me... Should I simply just use Session("intCount") instead or even Application("intCounter")?
I really need to understand why the hack is intCounter being stored in memory...
Thanks,

Yama

Nov 18 '05 #5
How can I keep track of a variable scope throughout veveral web pages other than using Sessions

I tried to use Shared member with a module but the problem is that it keeps the session in memory. So if you have 2 browsers open and on a click event in browser 1 you set shared variable stores to "Hello World" then switched to browser 2 the shared variable will have the value of "Hello World"..

Then instead of using a Module I changed it to a Shared property within a class but it resulted in the same bug..

You should try it..

Create a project
Add a Class.vb and call it component and copy and paste this code

Namespace tes
Public Class componen
Private Shared m_strReportName As String = String.Empt

Public Shared Property strReportName() As Strin
Ge
Return m_strReportNam
End Ge

Set(ByVal Value As String
m_strReportName = Valu
End Se
End Propert
End Clas
End Namespac

In you WebForm1.aspx.vb (code behind) copy and paste this
Namespace tes
Public Class WebForm
Inherits System.Web.UI.Pag

#Region " Web Form Designer Generated Code

'This call is required by the Web Form Designer
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent(

End Su
Protected WithEvents LinkButton1 As System.Web.UI.WebControls.LinkButto
Protected WithEvents LinkButton2 As System.Web.UI.WebControls.LinkButto

'NOTE: The following placeholder declaration is required by the Web Form Designer
'Do not delete or move it
Private designerPlaceholderDeclaration As System.Objec

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Ini
'CODEGEN: This method call is required by the Web Form Designe
'Do not modify it using the code editor
InitializeComponent(
End Su

#End Regio

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loa
If Not Page.IsPostBack The
If Not component.strReportName = "" The

End I
End I
End Su

Private Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Clic
component.strReportName = "Hello World 1
Response.Write(component.strReportName
End Su

Private Sub LinkButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton2.Clic
Response.Write(component.strReportName
End Su
End Clas
End Namespac

In your WebForm1.aspx html copy and paste the following
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="bugdemo.test.WebForm1"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title>WebForm1</title><meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"><meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1"><meta name="vs_defaultClientScript" content="JavaScript"><meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"></head><body ms_positioning="GridLayout"><form id="Form1" method="post" runat="server"><asp:linkbutton id="LinkButton1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server">Browser 1 Click This</asp:linkbutton><asp:linkbutton id="LinkButton2" style="Z-INDEX: 102; LEFT: 8px; POSITION: absolute; TOP: 32px
runat="server">Browser 2 Click This</asp:linkbutton></form></body></html

Now open two browsers and follow instructions... You will see that when you click on the link "Browser 2 Click This" in browser two the value of strReportName should have been empty instead it contains the value of strReportName set in browser 1

So my question is how can I resolve this problem

Yama Kamya

----- vMike wrote: ----

Maybe this will help
Modules are a reference type similar to classes, but with some importan
distinctions. The members of a module are implicitly Shared and scoped to
the declaration space of the standard module's containing namespace, rather
than just to the module itself. Unlike classes, modules can never be
instantiated, do not support inheritance, and cannot implement interfaces.

"Yama" <an*******@discussions.microsoft.com> wrote in message
news:51**********************************@microsof t.com...
Hi,
Actually the component code should be:
myModule.vb code: Namespace FinancialCompany.Portal
Public Module myModule
Public Class myProperties
Private _intCounter As System.Int32
Public Property intCounter() As System.Int32

Get
Return _intCounter
End Get
Set(ByVal Value As System.Int32)
_intCounter = Value
End Set
End Property
End Classs
End Module
End Namespace
default.aspx code:

Imports FinancialCompany.Portal.myModule.myProperties
Namespace FinancialCompany.Portal

Public Class _default
Inherits System.Web.UI.Page
Private m_test As System.Int32 = Request.QueryString("TEST")
Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs) If Not Page.IsPostback Then
If m_test = 0 Then intCounter += 0
If m_test = 1 Then intCounter += 1
If m_test = 2 Then intCounter += 2
Response.Write("Here is the result: " + CStr(m_test)) End If
End Sub
End Class
End Namespace Yama Kamyar

----- Yama wrote: -----
Hello All,
I have developed a new site using ASP.NET/VB.NET. I fell into a big problem. Here is the problem:
I created a module as follow:
Namespace FinancialCompany.Portal

Public Class myProperties
Private _intCounter As System.Int32
Public Property intCounter() As System.Int32

Get
Return _intCounter
End Get
Set(ByVal Value As System.Int32)
_intCounter = Value
End Set
End Property
End Classs
End Namespace Now I use this in an ASP.NET page as follow:

Imports FinancialCompany.Portal.myProperties
Namespace FinancialCompany.Portal

Public Class _default
Inherits System.Web.UI.Page
Private m_test As System.Int32 = Resquest.QueryString("TEST")
Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs) If Not Page.IsPostback Then
If m_test = 0 Then intCounter += 0
If m_test = 1 Then intCounter += 1
If m_test = 2 Then intCounter += 2
Response.Write("Here is the result: " + CStr(m_test))

End If
End Sub
End Class
End Namespace
Now when I tested this with two to five users with the following

URLs: User 1: http://localhost/myproject/default.aspx?TEST=0

User 2: http://localhost/myproject/default.aspx?TEST=1
User 3: http://localhost/myproject/default.aspx?TEST=2
If user 2 clicks the URL he gets:

Here is the result: 1
But if user 3 cllicks the URL he gets:

Here is the result: 3
instead of:
Here is the result: 2
Hence the intCount property remains active for every users!!! I expect it to be a different instance for each different users. How come is it being shared???
I am using Windows 2000 Server, ASP.NET 2003, & Framework 1.1
Hope someone can help me... Should I simply just use Session("intCount") instead or even Application("intCounter")? I really need to understand why the hack is intCounter being stored in memory... Thanks,
Yama

Nov 18 '05 #6
Here is what you need to do. In your class.vb add the following

Public Sub New
MyBase.New
me.m_strReportName = ""

End Sub

In your webform.aspx.vb do the following.

dim myReport as New component

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs)

Handles MyBase.Load
If Not Page.IsPostBack Then
If Not myreport.strReportName = "" Then

End If
End If
End Sub

Private Sub LinkButton1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)

Handles LinkButton1.Click
myreport.strReportName = "Hello World 1"
Response.Write(myreport.strReportName)
End Sub

Private Sub LinkButton2_Click(ByVal sender As Object, ByVal e As
System.EventArgs)

Handles LinkButton2.Click
Response.Write(myreport.strReportName)
End Sub
End Class
"Yama" <an*******@discussions.microsoft.com> wrote in message
news:B5**********************************@microsof t.com...
How can I keep track of a variable scope throughout veveral web pages other than using Sessions?
I tried to use Shared member with a module but the problem is that it keeps the session in memory. So if you have 2 browsers open and on a click
event in browser 1 you set shared variable stores to "Hello World" then
switched to browser 2 the shared variable will have the value of "Hello
World"...
Then instead of using a Module I changed it to a Shared property within a class but it resulted in the same bug...
You should try it...

Create a project:
Add a Class.vb and call it component and copy and paste this code:

Namespace test
Public Class component
Private Shared m_strReportName As String = String.Empty

Public Shared Property strReportName() As String
Get
Return m_strReportName
End Get

Set(ByVal Value As String)
m_strReportName = Value
End Set
End Property
End Class
End Namespace

In you WebForm1.aspx.vb (code behind) copy and paste this:
Namespace test
Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents LinkButton1 As System.Web.UI.WebControls.LinkButton Protected WithEvents LinkButton2 As System.Web.UI.WebControls.LinkButton
'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then
If Not component.strReportName = "" Then

End If
End If
End Sub

Private Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click component.strReportName = "Hello World 1"
Response.Write(component.strReportName)
End Sub

Private Sub LinkButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton2.Click Response.Write(component.strReportName)
End Sub
End Class
End Namespace

In your WebForm1.aspx html copy and paste the following:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="bugdemo.test.WebForm1"%><!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN"><html><head><title>WebForm1</title><meta name="GENERATOR"
content="Microsoft Visual Studio .NET 7.1"><meta name="CODE_LANGUAGE"
content="Visual Basic .NET 7.1"><meta name="vs_defaultClientScript"
content="JavaScript"><meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5"></head><body
ms_positioning="GridLayout"><form id="Form1" method="post"
runat="server"><asp:linkbutton id="LinkButton1" style="Z-INDEX: 101; LEFT:
8px; POSITION: absolute; TOP: 8px" runat="server">Browser 1 Click
This</asp:linkbutton><asp:linkbutton id="LinkButton2" style="Z-INDEX: 102;
LEFT: 8px; POSITION: absolute; TOP: 32px" runat="server">Browser 2 Click This</asp:linkbutton></form></body></html>

Now open two browsers and follow instructions... You will see that when you click on the link "Browser 2 Click This" in browser two the value of
strReportName should have been empty instead it contains the value of
strReportName set in browser 1.
So my question is how can I resolve this problem?

Yama Kamyar

----- vMike wrote: -----

Maybe this will help.
Modules are a reference type similar to classes, but with some important distinctions. The members of a module are implicitly Shared and scoped to the declaration space of the standard module's containing namespace, rather than just to the module itself. Unlike classes, modules can never be
instantiated, do not support inheritance, and cannot implement interfaces.
"Yama" <an*******@discussions.microsoft.com> wrote in message
news:51**********************************@microsof t.com...
> Hi,
>> Actually the component code should be:
>> myModule.vb code: > Namespace FinancialCompany.Portal
> Public Module myModule
> Public Class myProperties
> Private _intCounter As System.Int32
>> Public Property intCounter() As System.Int32

> Get
> Return _intCounter
> End Get
> Set(ByVal Value As System.Int32)
> _intCounter = Value
> End Set
> End Property
> End Classs
> End Module
> End Namespace
>> default.aspx code:

> Imports FinancialCompany.Portal.myModule.myProperties
>> Namespace FinancialCompany.Portal

> Public Class _default
> Inherits System.Web.UI.Page
>> Private m_test As System.Int32 = Request.QueryString("TEST") >> Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs)
> If Not Page.IsPostback Then
> If m_test = 0 Then intCounter += 0
> If m_test = 1 Then intCounter += 1
> If m_test = 2 Then intCounter += 2
>> Response.Write("Here is the result: " + CStr(m_test))
> End If
> End Sub
> End Class
> End Namespace
>>> Yama Kamyar
>> ----- Yama wrote: -----
>> Hello All,
>> I have developed a new site using ASP.NET/VB.NET. I fell into
a big problem. Here is the problem: >> I created a module as follow:
>> Namespace FinancialCompany.Portal > Public Class myProperties
> Private _intCounter As System.Int32
>> Public Property intCounter() As System.Int32

> Get
> Return _intCounter
> End Get
> Set(ByVal Value As System.Int32)
> _intCounter = Value
> End Set
> End Property
> End Classs
> End Namespace
>>> Now I use this in an ASP.NET page as follow:
>> Imports FinancialCompany.Portal.myProperties
>> Namespace FinancialCompany.Portal

> Public Class _default
> Inherits System.Web.UI.Page
>> Private m_test As System.Int32 =
Resquest.QueryString("TEST") >> Sub Page_Load(ByVal Sender As System.Object, ByVal e As

System.EventArgs)
> If Not Page.IsPostback Then
> If m_test = 0 Then intCounter += 0
> If m_test = 1 Then intCounter += 1
> If m_test = 2 Then intCounter += 2
>> Response.Write("Here is the result: " +

CStr(m_test)) > End If
> End Sub
> End Class
> End Namespace
>> Now when I tested this with two to five users with the

following URLs: >> User 1: http://localhost/myproject/default.aspx?TEST=0 > User 2: http://localhost/myproject/default.aspx?TEST=1
> User 3: http://localhost/myproject/default.aspx?TEST=2
>> If user 2 clicks the URL he gets:

> Here is the result: 1
>> But if user 3 cllicks the URL he gets:

> Here is the result: 3
> instead of:
> Here is the result: 2
>> Hence the intCount property remains active for every users!!!
I expect it to be a different instance for each different users. >> How come is it being shared???
>> I am using Windows 2000 Server, ASP.NET 2003, & Framework 1.1
>> Hope someone can help me... Should I simply just use Session("intCount") instead or even Application("intCounter")? >> I really need to understand why the hack is intCounter being
stored
in memory... >> Thanks,
>> Yama

>

Nov 18 '05 #7

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

Similar topics

6
by: varlagas | last post by:
We disabled the antivirus software but the problem persists. Any clues? Many thanks in advance! Panagiotis Varlagas ======================================================================= ...
2
by: Vitaly | last post by:
Hi, I've encountered a problem sharing c# application in NetMeeting. The problem is that when I try to share some GUI application, I don't see it on remote computer. Sometimes I see random small...
11
by: wASP | last post by:
Hi, I've got a pair of int properties in a class. The properties in question are indexing values - but that's not relevant to my problem - or it's just symptomatic ... sort of. They are...
2
by: Dano | last post by:
Hi all, I am trying to do something incredibly simple, but unforunately the Naziesque Security won't let me do it. All I want to do is write text to a file. That's it! But everytime I do I...
5
by: Jeff | last post by:
Hi - I'm creating an installation program that will install a VB.NET program and an instance of MSDE on an unknown desktop (commercial application). The install will include the MSDE...
33
by: Jeff | last post by:
I know this is a difficult one to answer, but I am interested in opinions on what hardware upgrades would be recommended with the following. Access 2000 running in a split config, but all in...
3
by: Dax | last post by:
//////////////// Inside the APPLICATION/ game //how do i get the same instance running in the //dll into my app? i.e the pointer ferrari //does not work ! it creates a new instance in the ...
8
by: mc | last post by:
I would like to be able to send from an ASP.NET page an email which when recieved takes the form of a "Sharing Invitation for a RSS Feed"...
11
by: limperger | last post by:
Hello everybody! I have just found out that the sharing properties of a single database (mdb file on a network), accessed by 3 users, change depending on the user accessing the database. That is,...
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
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
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
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
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...

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.