Re: Problem with asp.net app only allowing 1 user at a time
From: jsale (jsale_at_discussions.microsoft.com)
Date: 12/07/04
- Next message: David Browne: "Re: SqlHelper.ExecuteScalar"
- Previous message: Neven Klofutar: "Re: SqlHelper.ExecuteScalar"
- In reply to: John M Deal: "Re: Problem with asp.net app only allowing 1 user at a time"
- Next in thread: John M Deal: "Re: Problem with asp.net app only allowing 1 user at a time"
- Reply: John M Deal: "Re: Problem with asp.net app only allowing 1 user at a time"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 7 Dec 2004 06:53:04 -0800
I'm kinda new to professional asp.net development, so could you just clarify
the application and session objects?
I've got a module that houses many functions that all retrieve information
about their specific table from the database, writing the information into a
'.vb' class file. In effect, i am taking a snapshot of the database at that
current moment and storing it to the class, amending it there and then
writing changes back to the database afterwards. If i understand you
correctly, that is application level, therefore every user's instance of the
application sees the same data, whereas on a session level, each user would
see their own instance. Is this correct? If so, do you have any pointers
about making class files per session, not per application? I'm hugely
confused! The reason i'm developing like this is because i'm migrating an old
VB6 app and web-enabling it using ASP.NET. The old version used classes and i
was expected to re-use as much as possible. I think i understand that the
inherent difference is that with the old app it was installed seperately on
each computer, whereas the ASP.NET version is just one copy, installed on the
web server.
Any help would be gratefully receieved :)
"John M Deal" wrote:
> If I'm understanding you correctly you are loading data for the user
> from the database then storing that data into application scope. The
> issue that you then have is that you retrieve this data from application
> scope the next time the page is displayed. If this is the case then you
> should modify the way you are handling state management.
>
> The Application object should only be used to store data that is truly
> global to every user of the application. If you need to store things on
> a per user basis you should look into using the Session object. Using
> the Session object will allow you to store data classes on a per user
> basis.
>
> If you are worried about running the same query against the database
> multiple times, then you might want to abstract the use of the
> Application object (not a bad idea in general anyway) so that you can
> store a collection of query result sets keyed by the query used, then
> retrieve the appropriate result set for each user from the collection.
> If the collection doesn't contain the appropriate result set then you
> query the database and then add it to the collection and put the
> collection back in Application scope. Once you retrieve the appropriate
> result set from the application collection you could then put it in the
> user's Session object and continue your retrieval from there.
>
> Without more information on how you really intend to use these objects
> it is hard to know which solution to use, but hopefully something from
> the above will work for you.
>
> Have A Better One!
>
> John M Deal, MCP
> Necessity Software
>
> jsale wrote:
> > I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app
> > i have made is running on IIS v6 and consists of a number of pages that allow
> > the user to read information from the database into classes, which are used
> > throughout the application. I have made class collections which, upon reading
> > from the DB, create an instance of the class and store the DB values in
> > there temporarily. My problem is that if user1 looks at record1, then user2
> > looks at record2, anything user1 does from that point onwards points the data
> > at record2.
> > Is there anything in particular i need to do to make the asp.net application
> > available to multiple users at the same time, each looking at different
> > records in the DB?
> > Thanks in advance
>
- Next message: David Browne: "Re: SqlHelper.ExecuteScalar"
- Previous message: Neven Klofutar: "Re: SqlHelper.ExecuteScalar"
- In reply to: John M Deal: "Re: Problem with asp.net app only allowing 1 user at a time"
- Next in thread: John M Deal: "Re: Problem with asp.net app only allowing 1 user at a time"
- Reply: John M Deal: "Re: Problem with asp.net app only allowing 1 user at a time"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|