-2

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.

1 Answers1

0

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.

Community
  • 1
  • 1
ta.speot.is
  • 26,914
  • 8
  • 68
  • 96