Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4019816
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:09:06+00:00 2026-05-20T10:09:06+00:00

I have a aspx page to do asynchronous calls. The page gets data from

  • 0

I have a aspx page to do asynchronous calls. The page gets data from the database(spends 30 seconds in the stored procedure) and then returns the results to the client. This is done through a jquery post.

The problem is that while it does the stored procedure for 30 seconds, the rest of my site can’t make any requests.

I have <%@ Page Async="true" AsyncTimeout="600" Language="C#"... in the .aspx

My .aspx.cs contains:

      private SqlConnection _connection;
        private SqlCommand _command;
        private SqlDataReader _reader;

        protected void Page_Load(object sender, EventArgs e)
        {
            AddOnPreRenderCompleteAsync(BeginAsyncOperation, EndAsyncOperation);
        }

        protected IAsyncResult BeginAsyncOperation(object sender, EventArgs e, AsyncCallback cb, object state)
        {
            IAsyncResult result = null;
            try
            {
                SqlConnectionStringBuilder ConnectionStringBuilder = new SqlConnectionStringBuilder("**MyConnectionStringGoesHere**");
                ConnectionStringBuilder.AsynchronousProcessing = true;
                _connection = new SqlConnection(ConnectionStringBuilder.ConnectionString);

                _command = new SqlCommand("GetSiteUpdates", _connection) { CommandType = CommandType.StoredProcedure };
                _connection.Open();
                result = _command.BeginExecuteReader(cb, state);
                return result;
            }
            catch (Exception ex)
            {}
            return result;
        }

protected void EndAsyncOperation(IAsyncResult ar)
        {
            _reader = _command.EndExecuteReader(ar);
            try{
                   //Do Code Here
                   //Set Builder string here
                   Response.Clear();
                   Response.Write(builder.ToString());
                   _reader.Close();
                   Response.End();
            }
            catch (System.Threading.ThreadAbortException)
            {
                try { _reader.Close(); }
                catch { }
            }
            catch (Exception ex)
            {
                try { _reader.Close(); }
                catch { }
            }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:09:06+00:00Added an answer on May 20, 2026 at 10:09 am

    The reason for this is session locking. When a page opens with Read and Write access to the session (which is by defualt), it will lock the session preventing any other pages that require the session from loading.

    So two things here.

    1. A quick fix is to drop the session access and / or set it to read only for this page.

    2. Since you’re only returning JSON, you should use an ASP.Net handler (ashx) as this produces less overhead than an aspx page and, by default, has no session access (this can be added if necessary).

    Also, I’m not sure why you’re using async here. Since IIS has to wait until the page returns a response and since this page is doing nothing else, I see no benefit to using it asynchronously.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one web page MyWebPage.aspx which while loading has to show data from
I have .aspx page that page inserts the data to the database on a
I have Default.aspx page, which inherits from BasePage.cs, which inherits from System.Web.UI.Page. BasePage is
I have an .aspx page that generates thumbnails. It takes an ID and returns
I have a main page (Home.aspx) and on selecting a link from the menu
I have an aspx page that gets a list of documents available in a
I have an ASPX page that makes a lot of database queries that I
I have an ASPX page (On server A) which is invoked using NTLM credentials.
I have one aspx page with some controls. Also i have one DIV which
I have an aspx page,where the user will enter a valid image url(ex :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.