why does claring my URL Stack cause a delay in page reponsiveness ? RRS feed

  • Question

  • User1253338400 posted

    Hi ,

    I have the following in the server side code. Note the closeURLStack is defined as follows

    public Stack CloseURLStack
    get { return stkCloseURL; }
    set { this.stkCloseURL = value; }

    public static bool ClearCallStack()
       if (userContext != null && userContext.CloseURLStack != null && userContext.CloseURLStack.Count > 0)
         return true;

    It is called from javascript via the following

    function ActionMenuItemClick(e) {

    It seems that when the user clicks on a menu then there is no responsiveness for about 8 or so seconds and then the page renders . 

    If i comment out the PageMethos.ClearacALLsTACK()  it seems to be a bit faster. 

    Question is do I need to clear the url stack or is there a better way of doing this ?


    Friday, February 5, 2016 4:34 AM


  • User1814019480 posted

    Hi Robby,

    Thanks for your posting.

    Base on my experience, I think we can take those action to debug and resolve this issue.

    The first one:

    Could you try to add the breakpoint on your JS and server side code to test which steps toke long time caused the delay? I afraid that the script manager need time to load the JS file and script into the memory to call the server side function.

    So the second action is that I suggest you can change your code as the JQuery Ajax or xmlHttprequest to call the server side function.

    I recommend you refer to this demo:

    using JQuery:


    JS Code:

    <script type="text/javascript">   
        //Called this method on any button click  event for Testing
        function MyFunction(Param1, Param2) {                                               
            type: "POST",
            url: "MyPage.aspx/MyMethod",
            data: "{ Param1: '" + Param1+ "',Param2: '" + Param2 + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            async: "true",
            cache: "false",
            success: function (msg) {
                // On success                 
            Error: function (x, e) {
                // On Error

    Code behind Code:

    using System.Web.Services;
    public static void MyMethod(string Param1, string Param2)
            //Do here server event  
         catch (Exception)

    Also, you can use this method to call the code behind function:

    function loadServerData() {
       var xhttp = new XMLHttpRequest();
       xhttp.onreadystatechange = function() {
        if (xhttp.readyState == 4 && xhttp.status == 200) {
         document.getElementById("demo").innerHTML = xhttp.responseText;
      xhttp.open("GET", "mypage.aspx/mymethod", true);

    Please try it.

    Any concerns, please feel free to let me know.




    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 8, 2016 8:04 AM