Click here to Skip to main content
14,490,504 members

Session variables issue

Nayan Ambaliya asked:

Open original thread
Dear experts,

I have come across this may be stupid issue which I want someone else to shed some light on.

I have a web page (say default.aspx - ASP.Net / C#)

When this page loads, it does the following activity;

1. It grabs the windows user name from client's machine (because it is single sign on application)
2. Queries the database with the windows user name and then brings back all other credentials
3. Creates session variables for username, position... etc as per values from step 2 above
4. It then checks whether the user is acting as a PA for any other user by querying the database
5. If Yes, it then grabs all the people for whom they are acting as a PA and the creates tag for each manager
6. It then display the page
7. The last option would be the user itself which is hard coded in the page to go to the dashboard page

If the user clicks as to login as themselves, they go the dashboard page straight
If the user clicks on any manager, it then grabs all manager credentials and replaces the session variables with the one of managers and goes to the dashboard page

The issue is when the user login as themselves, the session previously established in step 3 above dis-appears and error occurs.

Please advice to resolve this if possible.


Tags: C#, Windows (Win2008-R2), ASP.NET, IIS (IIS7.5)


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100