473,387 Members | 1,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Error executing child request for...

Hi,
I've written a C# Server.Transfer from WebForm1.aspx to WebForm2.aspx
In both i'm using the same user control but with different params, for
example;

In the user control:

if(Request.ServerVariables["SCRIPT_NAME"]==Server.MapPath("WebForm1.aspx")){

lblTitle.Text = "Page 1";

}else{

if(Request.ServerVariables["SCRIPT_NAME"]==Server.MapPath("WebForm1.aspx")){

lblTitle.Text = "Page 2";

}

}

I works perfectly, but when i have the Server.Transfer("WebForm2.aspx"); it
keeps the Page 1 title from the WebForm1.aspx.
And if i try to instance my User control in WebForm2.aspx i have this error
in WebForm1.aspx: Error executing child request for WebForm2.aspx.
It changes to Page 2 title only when i use
Response.Redirect("WebForm2.aspx");

What is happening ?

Thanks in advance
Nov 17 '05 #1
3 8665
In message <Ov**************@TK2MSFTNGP09.phx.gbl>, Daniel Groh
<ne*********@gmail.com> writes
I works perfectly, but when i have the Server.Transfer("WebForm2.aspx"); it
keeps the Page 1 title from the WebForm1.aspx.
And if i try to instance my User control in WebForm2.aspx i have this error
in WebForm1.aspx: Error executing child request for WebForm2.aspx.
It changes to Page 2 title only when i use
Response.Redirect("WebForm2.aspx");

What is happening ?


Response.Redirect asks the browser to make a new request for the
specified page. Server.Transfer causes the server to return the output
from the specified page within the current response.

--
Steve Walker
Nov 17 '05 #2
Ok but why it's keeping the same user control from my Page1.aspx page ?
I added a Label in my Page2.aspx and everythink ok...it show, but still
keeps in the url bar Page1.aspx and should show Page2.aspx.

=/

"Steve Walker" <st***@otolith.demon.co.uk> escreveu na mensagem
news:QU**************@otolith.demon.co.uk...
In message <Ov**************@TK2MSFTNGP09.phx.gbl>, Daniel Groh
<ne*********@gmail.com> writes
I works perfectly, but when i have the Server.Transfer("WebForm2.aspx");
it
keeps the Page 1 title from the WebForm1.aspx.
And if i try to instance my User control in WebForm2.aspx i have this
error
in WebForm1.aspx: Error executing child request for WebForm2.aspx.
It changes to Page 2 title only when i use
Response.Redirect("WebForm2.aspx");

What is happening ?


Response.Redirect asks the browser to make a new request for the specified
page. Server.Transfer causes the server to return the output from the
specified page within the current response.

--
Steve Walker

Nov 17 '05 #3
In message <et*************@TK2MSFTNGP12.phx.gbl>, Daniel Groh
<ne*********@gmail.com> writes
I works perfectly, but when i have the Server.Transfer("WebForm2.aspx
"); it keeps the Page 1 title from the WebForm1.aspx. And if i try to
instance my User control in WebForm2.aspx i have this error in
WebForm1.aspx: Error executing child request for WebForm2.aspx. It
changes to Page 2 title only when i use Response.Redirect("WebForm2.a
spx"); What is happening ?
Response.Redirect asks the browser to make a new request for the specified
page. Server.Transfer causes the server to return the output from the
specified page within the current response.
Ok but why it's keeping the same user control from my Page1.aspx page ?
I added a Label in my Page2.aspx and everythink ok...it show, but still
keeps in the url bar Page1.aspx and should show Page2.aspx.


To be honest, I don't know why your control is causing an exception to
be thrown. Put a try/catch block around the code in the control, and set
a breakpoint in the catch block. It's a separate issue from what shows
in the title bar, though. As far as the browser is concerned, it is
looking at WebForm1.aspx. The Server.Transfer has happened on the server
side, and the browser knows nothing of it.

What you are trying to do with Request.ServerVariables["SCRIPT_NAME"]
will not work with Server.Transfer, because it will always return the
page the browser requested, not the one you transferred to. You would be
better off doing something like this:

public interface ITitledPage
{
string PageTitle{get;}
}

public class WebForm1 : System.Web.UI.Page, ITitledPage
{
.....

public string PageTitle
{
get
{
return "Page 1";
}
}

.....
}

public class WebForm2 : System.Web.UI.Page, ITitledPage
{
.....

public string PageTitle
{
get
{
return "Page 2";
}
}

.....
}

and in your webcontrol:

ITitledPage page = this.Page as ITitledPage;
if(page!=null)
{
this.lblTitle.Text = page.PageTitle;
}

--
Steve Walker
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tim C. | last post by:
I get the error "error executing child request" when I use the Server.Transfer method to invoke a second aspx page. The following code is executed in a LinkButton click eventhandler on Page1.aspx....
0
by: John A Grandy | last post by:
I solved this problem once before ... but I've forgotten exactly how I solved it ... Directly beneath my web-app root-folder, I have a two sub-folders, Folder1 and Folder2. Folder1 contains...
0
by: diesel | last post by:
I am doing a very simple Server.Transfer("myPage.aspx", TRUE) Locally on my machine and on the development server there are no issues Once I move it to the production server I get the message...
0
by: rilian | last post by:
For those encountering the 'Error executing child request for...' error, the following may bring some light on the problem. It is possible that the page you are transfering/executing to is...
1
by: EagleRed | last post by:
I am developing an ASP.NET 2.0 application using a master page. I have a DataList control on the master page that has a datasource this is an ArrayList of objects that have a CmdURL property. ...
21
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
0
by: Gorkana | last post by:
When doing Server.Transfer I am getting the following error 'Error executing child request ' after I make the change in the web.config debug="true" to debug="false". When set to true the transfer...
2
by: rico.fabrini | last post by:
Hello Everyone, I've suddenly started running into the error "error executing child request for Page.aspx" when doing a Server.Transfer("Page.aspx"); That's on a Win2003 Server machine. ...
0
by: David C | last post by:
We have a user getting an error message as follows: Error executing child request for handler 'ASP.frmpropertyclosings_aspx'. The line in the code-behind page that is causing the error is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.