Run Multiple .aspx Pages in VS Programming Environment

  • Thread starter Thread starter George
  • Start date Start date
G

George

VS.NET 2002/VB

In my project, two different .aspx pages need to be open by the user in different browser windows. I
need a small amount of information in the first form to be available to the second form.

I'm not even sure I'm doing this right, but I have created a public array in the first form and
saved the information there (I do not have DB access at my site). That public array should be
accessible to the second form, because it is in the same project. When I make a reference to the
public array in the second form, I do not get that squiggle line under it, so I assume that part
will work okay.

The problem is, I can run one form or the other, but not both at the same time. How do I run both of
those .aspx pages at the same time in my VS.NET programming environment so I can finish coding and
testing the second form? Or am I doing this all wrong?

Thanks,
George
 
And what is the scope of that public array? Is that something that multiple users will all have
access to? If so, then that approach won't work, because that public array needs to be restricted to
the one user with both windows open, and not accessible by any other user. If another user comes to
the site, another public array needs to be created for that user, and so on.

I have a feeling I'm approaching this all wrong. ;-)

Thanks,
George
 
Hi,

First due to ASP.NET stateless mode, when server side page finished it
work and render HTML to the client the page object retired and fall to
the worm hands of GC mechanism. So even you got ASPX page on client side
there isn't any ASPX object on server side. If you will try to access
one page from another you will get new instance of the first page
without any of your array data in it.

If you are looking for fast and easy implementation but hard to
maintain, you can store your data in application cache. In cache you
need to unify that data with GUID or any other unique identifier. That
GUID should be handled to the second page and used on the page server
side to get data from the cache.

Alternatively you can implement MVC and data storage to solve that
problem in more architectural and maintenance way .

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 
Srinivasa and Natty,

I just found out that if you open a new window from another window, it uses the same session. That
is what I am doing, so a session variable will work, after all. Sorry, should have pointed that out
earlier.

I tested it at my site, and the session variable works fine. I just can't figure out how to test it
locally, 'cause I can't find a way to open multiple windows in the VS.NET 2002/VB programming
environment.

George

G.V.Srinivasa Rao said:
Hi George,

Your problem can be solved, if you put the array in an application variable instead of in a
public variable. Even putting in the Session variable will not work as each individual internet
explorer browser counts to an individual session.
 
You declared a public array in a class and because it is part of the class
definition and is declared as public, and part of the same project, it is
accessible to another instance of another class, at another time? Do you
realize that the pages on the client exist long after the classes that
created them have been destroyed? That the lifetime of a Page class is
measured in milliseconds? Do you understand what instantiation is? .Net is
object-oriented, which means that you should have a firm grasp of
object-oriented principles (inheritance, encapsulation, polymorphism, etc)
before you try to work with it. In addtion, ASP.Net operates in an HTTP
environment, which means that you should understand something about HTTP as
well in order to use it effectively.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Understand. I have a general idea of how all that works, but not a firm grasp. That is why I am
exploring, experimenting, and asking questions.

Actually, I didn't declare it in the page class... that is why it was accessible to another instance
of another page class in another window... but in the same session. As I said, I am just
experimenting with things.

Thanks.
George
 
Back
Top