i click on a button which access the database query.When the searched data is in large amount,it takes longer time.The database layer i use is LINQ.Problem is that inbetween that process i want to logout from site but logout process remains in queue,Please suggest me.
-
2It would help to put some code here. What do you do when you log someone out? – dcaswell Sep 07 '13 at 04:55
-
logout – Sandeep Chadgal Sep 07 '13 at 06:02
-
In the question no one can see any slow database, or c# code. – dcaswell Sep 07 '13 at 06:04
1 Answers
Your question doesn't specify, but I'm making the assumption that logout process remains in queue refers to a HTTP request.
If you're using ASP .NET Session State, you might have your requests executing serially instead of concurrently. In which case, the logout request will be blocked until your request with the database query completes.
This page has more information, and a solution for Web Forms.
To prevent two pages from modifying in-process Session variables at the same time, the ASP.NET runtime uses a lock. When a request arrives for a page that reads and writes Session variables, the runtime acquires a writer lock. The writer lock will block other pages in the same Session who might write to the same session variables.
...
If this behavior causes a problem ... tell the runtime how the page intends to use Session variables
The equivalent solution for MVC is discussed here.

- 1
- 1

- 26,914
- 8
- 68
- 96