Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 5th, 2006, 08:57 AM
Authorized User
 
Join Date: Nov 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with users seeing each other's data

I have a web application written in ASP.NET 1.1, but am having problems with users seeing each other's data.

I am not using static variables anywhere, and this problem occurs regardless of whether I set "cookieless" to true or false in web.config. I am using the Session object to store each users data rather than the cache object.

When the application starts the user is prompted to log on. A database connection (SQL or Oracle) is then established (the connection string is always the same).

The problem occurrs when both users perform the same operation at the same time. These involve the execution of a query. It is when the results of the query are displayed in the browser that the problem occurs: user A often sees the query results for user B rather than his own results.

I am opening a connection to the database just before the query is executed, then closing it immediately afterwards. Is it possible that connection pooling is causing this to happen?

Thanks for your help
Gary

 
Old September 5th, 2006, 10:02 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Can you give me an example of the query that you are using? It doesn't make sense that user A would see user B's data unless it was reflected in the query.

"The one language all programmers understand is profanity."
 
Old September 5th, 2006, 10:10 AM
Authorized User
 
Join Date: Nov 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

An example of the queries are:-

User A: "SELECT * FROM Subjects WHERE GENDER = 'MALE'"
User B: "SELECT * FROM Subjects WHERE GENDER = 'FEMALE'"

These work fine on their own in a single user scenario, but often User B will see User A's results, i.e. results will be all MALE instead of FEMALE.


 
Old September 5th, 2006, 10:51 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

This is extremely weird and can't say that i have ever encountered this problem. How do you determine what query the users will execute, though sessions?

"The one language all programmers understand is profanity."
 
Old September 5th, 2006, 10:56 AM
Registered User
 
Join Date: Sep 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

If ur query should return diffrent data for each user ,Then U must add another condition in where clause

eg. "SELECT * FROM Subjects WHERE GENDER = 'MALE'" and username = session("username")


 
Old September 5th, 2006, 11:02 AM
Authorized User
 
Join Date: Nov 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The user builds up a query using a search criteria form. This definitely works as it has been used by several customers over the past year, but mainly one user at a time until now.

The query is then stored in a Session variable, before being passed to the database to execute.

The user name or session ID have nothing to do with the query results. Any users running the same query should get the same data

 
Old September 5th, 2006, 11:14 AM
Registered User
 
Join Date: Sep 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No Need to store the query in session object.u can store the query in variable inside the method and exeucte the query directly and check it.

 
Old September 5th, 2006, 11:19 AM
Authorized User
 
Join Date: Nov 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply but that's irellevant! I need to use a session variable as the query is built up gradually by the user. I'm not a beginner and don't need any help in executing queries - I just need to know why one user get's another user's dataset.

Thank you

 
Old September 5th, 2006, 12:26 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Ok lets all sit back, relax, and take a deep breath! Yes, regardless if the query is stored in session or not, that is obviously not the problem nor do I think this is a connection pool issue.

What I find most puzzling is that you are saying that if user A and user B execute their querys at the same time, the result set of query string A gets sent to user B and vice versa.

Is there anything else we should know about this application because, what you are describing, just doesn't seem possible.



"The one language all programmers understand is profanity."
 
Old October 2nd, 2006, 04:08 AM
Authorized User
 
Join Date: Nov 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My application is set to cookieless="true" in web.config. I have read that the 24 character session ID generated is not guaranteed to be unique. Is it possible that I have 2 clients with the same session ID. This problem has only happened a couple of times, and all of the application data is stored in Session variables.

Thanks,
Gary






Similar Threads
Thread Thread Starter Forum Replies Last Post
users login problem luisman_luisman BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 8 November 12th, 2009 03:48 PM
Developing .NET app to access other's machine debsoft .NET Web Services 5 October 17th, 2006 04:22 AM
Problem with authentication users hcusto BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 August 9th, 2006 02:32 PM
problem with tomcat-users.xml (4.1.24) holdmykidney Apache Tomcat 0 August 24th, 2005 04:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.