Getting Stack overflow error in webform

Posted on 2008-11-15
Last Modified: 2013-11-08
Hi ,
i have created an application in 3.5.While i am using crosspage posting i have seen the page load function is happening twice and some times i am getting error message like stack overflow at line 0.Really i have no clue about this kind of error.can any one suggest me how to get this probem to be solved.
Question by:tanu80
    LVL 8

    Expert Comment

    Your page_load function occurres twice in what page?
    What code do you have there ?
    LVL 13

    Expert Comment

    Stack overflow happens some times when your code goes into an infinite loop. Check your logic to see if there is any possibility of infinite loops

    Author Comment

    i am using this code for otherinformation page in my application
     String _callbackResult = String.Empty;
            String strFolderPath = Common1ext.Common.Config.GetAppSettingsFromWebConfig("Profile_thumbnail");
            String strMyPID = string.Empty;

            protected void Page_Load(object sender, EventArgs e)
                if (Session["Username"] == null)
                if (!IsPostBack)
                    ViewState["PageNumber"] = 1;
                    ViewState["PageSize"] = 5;
                    ViewState["CurrentPageIndex"] = 0;

                    if (Request.QueryString["uid"] != null)
                        String strFID = Utility.DecryptNumber(Request.QueryString["uid"].ToString());
                        if (strFID != "-1")
                            ViewState["VisitedUserPID"] = strFID;
                            BindUserProfileData(Convert.ToInt32(strFID), (Int32)ViewState["PageSize"], (Int32)ViewState["PageNumber"]);

                            String cbReference = Page.ClientScript.GetCallbackEventReference(this, "arg", "getValueFromServer", "context", "getErrorFromServer", false);
                            String cbscript = "function UseCallback(arg,context){" + cbReference + ";}";
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "UseCallback", cbscript, true);

    LVL 13

    Accepted Solution

    This code looks fine. I find no reason in the given code for a stack over flow unless if this page is "Login.aspx".

    1. check if there is any recursive loops
    2. check if there is any page that recursively redirects to itself

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now