Wednesday, March 28, 2012

Simple ASP.NET Application : Wrong Username gets selected in Multiuser

Hi,
We have developed a small application in ASp.net ( framework 1.1 ) . Ithas a login page which accepts username and password. When user isauthenticated , application takes the user to page he has a text box toenter data and a save button. The data is saved in Oracle 8i database (linux server ) and ASP.NET application is hosted on WIN2000 server.There are about 50 workstations with either win98 or win2k prof as OS ,using this application.
Well the problem is when the user is authenticated and taken to secondpage the username the label shows is different from the actual usernamelogged in. Actually this has been noticed that the wrong username thelabel is showing has logged in at some other workstation. So all thisgets hotch potch when multi users access this application . But worksfine when there is only one user on entwork accessing this application.
Application has been written in VB.NET in VS.NET 2003. It uses publicvariables to store username throughout the application. What could bethe reason for wrong picking of username on page2 ?
I have checked and debugged it for correct authentication on page 1.

navdeep_007 wrote:

Hi,
Application has been written in VB.NET in VS.NET 2003. It uses publicvariables to store username throughout the application. What could bethe reason for wrong picking of username on page2 ?


What exactly do you mean by "public variables"?

Hi
I have declared Public variable in Module as
Public sUserName$
Public sUserCode$
These variables are used both on page1 and page2.
Thanks..


You cannot maintain state with public variables. See a technical explanation of what effect this has in this blog post:Public Variables In VB.NET Modules
See Steve Smith's article Nine Options for Managing Persistent User State in Your ASP.NET Application for an overview of how to manage state. You might consider using Session state to store the user's ID.

0 comments:

Post a Comment