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

x
?
Solved

Urgent : Error executing child request

Posted on 2006-05-20
3
Medium Priority
?
1,797 Views
Last Modified: 2009-07-29
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;
                        }
                  }
            }
0
Comment
Question by:poobalanr072299
1 Comment
 
LVL 6

Accepted Solution

by:
the_paab earned 2000 total points
ID: 16723839
When you use the Server.Transefer then url in browser is not changed because page change pass on server (and client don't know about it). Use Response.Redirect instead, then the address will be changed as you need, because page change happens on clinet side.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Integration Management Part 2
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month19 days, 6 hours left to enroll

834 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