[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 488
  • Last Modified:

Getting Stack overflow error in asp.net webform

Hi ,
i have created an application in asp.net 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.
0
tanu80
Asked:
tanu80
  • 2
1 Solution
 
tiagosalgadoCommented:
Your page_load function occurres twice in what page?
What code do you have there ?
0
 
TechTiger007Commented:
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
0
 
tanu80Author Commented:
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)
            {
                Response.Redirect("Login.aspx");
            }
            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);

                    }
                    else
                    {
                        Response.Redirect("PageNotFound.aspx");
                    }
                }
            }
        }
0
 
TechTiger007Commented:
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
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now