Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
After the user logs on, username/userid will be stored in Session.Session is stored on the user's computer.I need to get employeeid after the employee logged on to insert into table named Order in the database.I mean customers visit my site can see employeeid is online now.I do not want to create a table or column for it
Posted

1 solution

The session will keep the information about each employee independently. i suggest you create an Application variable, whenever an employee logs in i.e. in session.start add his username to the Application variable(sort of list)(also, here you might have to dip in DB to check the user validity). once multiple employees are online the application variable will contain all their names.

now when a customer logs in, use this application variable and show the logged in employees names to him.

Let me know if my understanding is not correct. i will refine my answer.

EDIT - The Application valriable I am talking about is the state management technique which will allow you to save some values which will be accessed by all the users. check out msdn documentation for details. and see this article to get a cursory idea - A Beginner's Tutorial on ASP.NET State Management[^]
 
Share this answer
 
v2
Comments
giatuan2011 7-Jun-12 6:43am    
I just need to received an employee name.
You mean creating a normal variable in the page?
Ex:string WorkerName="<the employee's name after he login>";
Rahul Rajat Singh 7-Jun-12 6:49am    
No i mean Application variable so that it will be accessible by all the users of site. check the updates in my answer to know how to use it(link)
giatuan2011 7-Jun-12 9:04am    
So,It is Application[""]=value??
Rahul Rajat Singh 8-Jun-12 0:13am    
i could not update the answer as the servers went down. i have updated the answer and yes you are in the right direction.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900