Link to home
Start Free TrialLog in
Avatar of poobalanr072299
poobalanr072299

asked on

Urgent : Error executing child request

I'm having a default.aspx page. My application uses pages where each page has a pageid and each pageid follows a template format. Each template format is created as template1.aspx, template2.aspx..etc..

But in my url when i type http://localhost/mydomain/default.aspx?pageid=122 then default.aspx check the pageid and redirects to the template page (say Template5.aspx) and then it should not show http://localhost/mydomain/Template5.aspx?pageid=122  but  http://localhost/mydomain/default.aspx?pageid=122. Inorder to acheive this, i'm following this code in my default.aspx page.

I'm using Server.Transfer to acheive this url format.

But when i use this, it gives 'Error executing child request for template5.aspx' error.


default.aspx.cs:
--------------

      private void Page_Load(object sender, System.EventArgs e)
            {
                  try
                  {
                        if (!Page.IsPostBack)
                        {
                              if(Request.QueryString["Flag"]!=null)
                              {
                                    if (Convert.ToBoolean(Request.QueryString["Flag"])==true)
                                    {
                                          Server.Transfer("Search.aspx");
                                    }
                                    else
                                    {
                                          Server.Transfer("Search.aspx");
                                    }
                              }
                              if (Request.QueryString["Pageid"]==null)
                              {
                                    HomepageId=Convert.ToInt32(ConfigurationSettings.AppSettings["HomepageId"]);
                                    HomeTemplateId=Convert.ToInt32(ConfigurationSettings.AppSettings["HomeTemplateId"]);
                                    ipageid=HomepageId;
                                    iTemplateid=HomeTemplateId;
                              }
                              else
                              {
                                    ipageid=Convert.ToInt32(Request.QueryString["Pageid"]);
                                    iTemplateid = objTemp.GetTemplateid(ipageid);
                              }
                              Session["ipageid"]=ipageid;
                              Session["iTemplateid"]=iTemplateid;

                              if(Request.QueryString["Year"]!=null)
                              {
                                    Server.Transfer("Template"+iTemplateid+".aspx");
                              }
                              else if((Request.QueryString["bselected"]!=null) && (Request.QueryString["Index"]!=null))
                              {
                                    Server.Transfer("Template"+iTemplateid+".aspx");
                              }
                              else
                              {
                                    Server.Transfer("Template"+iTemplateid+".aspx");
                              }
                              if(Request.Url.ToString().IndexOf("Template",1)>0)
                              {
                                    Server.Transfer("Template"+iTemplateid+".aspx");
                              }
                        }
                  }
                  catch(Exception ex)
                  {
                        if(ex !=null)
                        {
                              //this.lblMessage.Text =Utility.ErrorCall("ERR_UNIDFD_ERROR");                        
                              //lblMessage.Visible = true;
                        }
                  }
            }
ASKER CERTIFIED SOLUTION
Avatar of the_paab
the_paab

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial