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

Strange Behaviour

I have a set of aspx pages created using VSNET 2003/VB. The web site
includes a java based menu. For a specific selection I need to change the
value of a variable in a common class. I set the menu app to call a special
aspx page whose only purpose is to set the class variable and then transfer
to the main aspx page. The initial page originally had only the following
code:
============================================
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
CommonClass.strCallFrom = "User"

Server.Transfer("frmFindBand.aspx")

End Sub

================================================== =======

That does not work - the CommonClass.strCallFrom variable is not getting
set? Any ideas as to why this is failing?

TIA

Wayne
Nov 19 '05 #1
7 1244
Wayne,

Welcome to the web development world. Once you leave a page, it doesn't
exist anymore. Neither there is CommonClass instance, unless you took
special care to make it persistent. You should save the variable in one of a
few persistent storages, for example in a session variable.

Eliyahu

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:us*************@TK2MSFTNGP15.phx.gbl...
I have a set of aspx pages created using VSNET 2003/VB. The web site
includes a java based menu. For a specific selection I need to change the
value of a variable in a common class. I set the menu app to call a special aspx page whose only purpose is to set the class variable and then transfer to the main aspx page. The initial page originally had only the following
code:
============================================
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
CommonClass.strCallFrom = "User"

Server.Transfer("frmFindBand.aspx")

End Sub

================================================== =======

That does not work - the CommonClass.strCallFrom variable is not getting
set? Any ideas as to why this is failing?

TIA

Wayne

Nov 19 '05 #2
Is the strCallFrom is a static variable or instance variable? If its not
static variable, I do not see any code to instantiate the CommonClass
object???

--
Kumar Reddi
http://kumarreddi.blogspot.com

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:us*************@TK2MSFTNGP15.phx.gbl...
I have a set of aspx pages created using VSNET 2003/VB. The web site
includes a java based menu. For a specific selection I need to change the
value of a variable in a common class. I set the menu app to call a special aspx page whose only purpose is to set the class variable and then transfer to the main aspx page. The initial page originally had only the following
code:
============================================
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
CommonClass.strCallFrom = "User"

Server.Transfer("frmFindBand.aspx")

End Sub

================================================== =======

That does not work - the CommonClass.strCallFrom variable is not getting
set? Any ideas as to why this is failing?

TIA

Wayne

Nov 19 '05 #3
Note that static variables have application scope as opposed to session.
That means the two sessions while overwrite each other setting.

Eliyahu

"Kumar Reddi" <ku********@REMOVETHIS.gmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Is the strCallFrom is a static variable or instance variable? If its not
static variable, I do not see any code to instantiate the CommonClass
object???

--
Kumar Reddi
http://kumarreddi.blogspot.com

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:us*************@TK2MSFTNGP15.phx.gbl...
I have a set of aspx pages created using VSNET 2003/VB. The web site
includes a java based menu. For a specific selection I need to change the value of a variable in a common class. I set the menu app to call a

special
aspx page whose only purpose is to set the class variable and then

transfer
to the main aspx page. The initial page originally had only the following code:
============================================
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
CommonClass.strCallFrom = "User"

Server.Transfer("frmFindBand.aspx")

End Sub

================================================== =======

That does not work - the CommonClass.strCallFrom variable is not getting
set? Any ideas as to why this is failing?

TIA

Wayne


Nov 19 '05 #4
Thanks for the replies guys but I really don't understand the need to
instance the class? If I add a button to the page and issue the transfer
from the click event, things work fine? What is different (I will readily
admit that I have a poor grasp of OO)?

Throughout the other 20+ pages I regularly set a CommonClass variable and
then use it in another page. I thought that was the whole idea of a common
class?

Any education is much appreciated.

Wayne

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:OK**************@TK2MSFTNGP09.phx.gbl...
Wayne,

Welcome to the web development world. Once you leave a page, it doesn't
exist anymore. Neither there is CommonClass instance, unless you took
special care to make it persistent. You should save the variable in one of a few persistent storages, for example in a session variable.

Eliyahu

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:us*************@TK2MSFTNGP15.phx.gbl...
I have a set of aspx pages created using VSNET 2003/VB. The web site
includes a java based menu. For a specific selection I need to change the value of a variable in a common class. I set the menu app to call a

special
aspx page whose only purpose is to set the class variable and then

transfer
to the main aspx page. The initial page originally had only the following code:
============================================
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
CommonClass.strCallFrom = "User"

Server.Transfer("frmFindBand.aspx")

End Sub

================================================== =======

That does not work - the CommonClass.strCallFrom variable is not getting
set? Any ideas as to why this is failing?

TIA

Wayne


Nov 19 '05 #5
You won't see a problem until there are simultaneous user's making
requests to your web application. You are using a single location to
store a piece of data for all users. Their requests will start
overwriting this single location with data for each request. Depending
on the timing user A could get user B's results or user B might get
user A's results.

It's always good to keep request state as close to the request as
possible. Don't try to take shortcuts by sticking a piece of data in a
common class and hope that when something later happens it still finds
the data there.

The Context.Items collection is a good place to store the information
you need to carry around.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Sun, 6 Mar 2005 11:10:53 -0700, "Wayne Wengert"
<wa***************@wengert.com> wrote:
Thanks for the replies guys but I really don't understand the need to
instance the class? If I add a button to the page and issue the transfer
from the click event, things work fine? What is different (I will readily
admit that I have a poor grasp of OO)?

Throughout the other 20+ pages I regularly set a CommonClass variable and
then use it in another page. I thought that was the whole idea of a common
class?

Any education is much appreciated.


Nov 19 '05 #6
Scott;

Thanks for the information. I think I am beginning to see my error here. The
Common Class information exists once for my application and if User A sets a
value in variable "X", any user asking for that variable will get that new
value? This was my first attempt at using a common class and I think I went
way overboard. I'll go back and change all use of the common class variables
to Session objects instead and just use the common class for constant values
like connection strings. Does that sound right?

Wayne

"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:f7********************************@4ax.com...
You won't see a problem until there are simultaneous user's making
requests to your web application. You are using a single location to
store a piece of data for all users. Their requests will start
overwriting this single location with data for each request. Depending
on the timing user A could get user B's results or user B might get
user A's results.

It's always good to keep request state as close to the request as
possible. Don't try to take shortcuts by sticking a piece of data in a
common class and hope that when something later happens it still finds
the data there.

The Context.Items collection is a good place to store the information
you need to carry around.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Sun, 6 Mar 2005 11:10:53 -0700, "Wayne Wengert"
<wa***************@wengert.com> wrote:
Thanks for the replies guys but I really don't understand the need to
instance the class? If I add a button to the page and issue the transfer
from the click event, things work fine? What is different (I will readily
admit that I have a poor grasp of OO)?

Throughout the other 20+ pages I regularly set a CommonClass variable and
then use it in another page. I thought that was the whole idea of a commonclass?

Any education is much appreciated.

Nov 19 '05 #7
Hi Wayne:

Yes, that's what can happen with Shared fields in VB.NET.

Like I say, Context.Items can be just as useful as Session if you need
information to stick around during a Server.Transfer

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sun, 6 Mar 2005 13:58:41 -0700, "Wayne Wengert"
<wa***************@wengert.com> wrote:
Scott;

Thanks for the information. I think I am beginning to see my error here. The
Common Class information exists once for my application and if User A sets a
value in variable "X", any user asking for that variable will get that new
value? This was my first attempt at using a common class and I think I went
way overboard. I'll go back and change all use of the common class variables
to Session objects instead and just use the common class for constant values
like connection strings. Does that sound right?

Wayne


Nov 19 '05 #8

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

Similar topics

0
by: Frank Passek | last post by:
Dear all, I've encountered some strange behaviour with PHP (4.3.2) using the CLI-API. When I provide an option in the first line of my script like so: #!/usr/bin/php -c /path_to_my_ini_file and...
0
by: Phil | last post by:
Hi, I don't understand this strange behaviour: I compile this code : #include <Python.h> #include"Numeric/arrayobject.h" static PyObject *
2
by: Paul Drummond | last post by:
Hi all, I am developing software for Linux Redhat9 and I have noticed some very strange behaviour when throwing exceptions within a shared library. All our exceptions are derived from...
3
by: Bruno van Dooren | last post by:
Hi All, i have some (3) different weird pointer problems that have me stumped. i suspect that the compiler behavior is correct because gcc shows the same results. ...
3
by: Sebastian C. | last post by:
Hello everybody Since I upgraded my Office XP Professional to SP3 I got strange behaviour. Pieces of code which works for 3 years now are suddenly stop to work properly. I have Office XP...
6
by: Edd Dawson | last post by:
Hi. I have a strange problem involving the passing of command line arguments to a C program I'm writing. I tried posting this in comp.programming yesterday but someone kindly suggested that I'd...
31
by: DeltaOne | last post by:
#include<stdio.h> typedef struct test{ int i; int j; }test; main(){ test var; var.i=10; var.j=20;
4
by: Gotch | last post by:
Hi, I'm getting a very strange behaviour while running a project I've done.... Let's expose it: I've two projects. Both of them use a Form to do some Gui stuff. Other threads pack up messages...
8
by: Dox33 | last post by:
I ran into a very strange behaviour of raw_input(). I hope somebody can tell me how to fix this. (Or is this a problem in the python source?) I will explain the problem by using 3 examples....
20
by: Pilcrow | last post by:
This behavior seems very strange to me, but I imagine that someone will be able to 'explain' it in terms of the famous C standard. -------------------- code -----------------------------------...
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
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
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...
0
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,...

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.