Every time my web application hits SQL server a query or Procedure should be called and should return its values to web application.

How can i do this?

Using delegates and events.

I want to include auto log off functionality in my application. When a member logs in with different session the previous session should expire automatically.

I am doing this with a timer control. Every interval it checks for member log from database.

I want to reduce database hits. I want to check member log only when member does some activity on application.

1. You could have a collumn which stores SessionID. When user logs in from another location, it replaces the SessionID and he is logged off from old location.
2. If I was doing that with timer in ASP.NET application, application would got crazy.
3. On each user action you can call function to check if user is logged.


that you said i can do with the help of delegates and events. Can you help me more in creating delegate?

I use them rarely, but some good books/tutorials could be found on Internet. I recommend you Microsoft Visual C# 2008 - John Sharp - Microsoft Press.

I have more then 50 pages in my application. I want something common to entire application. wch will check On each user action for member log in database.


Any other way to achieve "auto log off functionality"??

- Make that procedure into Global.asax file.
- I think it's stupid that 2 same users are logged in the same time.