473,842 Members | 1,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Serv erVariables["SCRIPT_NAM E"]==Server.MapPat h("WebForm1.asp x")){

lblTitle.Text = "Page 1";

}else{

if(Request.Serv erVariables["SCRIPT_NAM E"]==Server.MapPat h("WebForm1.asp x")){

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.Redire ct("WebForm2.as px");

What is happening ?

Thanks in advance
Nov 17 '05 #1
3 8699
In message <Ov************ **@TK2MSFTNGP09 .phx.gbl>, Daniel Groh
<ne*********@gm ail.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.Redir ect("WebForm2.a spx");

What is happening ?


Response.Redire ct 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*********@gm ail.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.Redi rect("WebForm2. aspx");

What is happening ?


Response.Redire ct 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*********@gm ail.com> writes
I works perfectly, but when i have the Server.Transfer ("WebForm2.a spx
"); 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.asp x: Error executing child request for WebForm2.aspx. It
changes to Page 2 title only when i use Response.Redire ct("WebForm2.a
spx"); What is happening ?
Response.Redire ct 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.ServerV ariables["SCRIPT_NAM E"]
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.P age, ITitledPage
{
.....

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

.....
}

public class WebForm2 : System.Web.UI.P age, ITitledPage
{
.....

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

.....
}

and in your webcontrol:

ITitledPage page = this.Page as ITitledPage;
if(page!=null)
{
this.lblTitle.T ext = 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
35155
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. Server.Transfer("Page2.aspx",True) This code is virtually identical to the examples in chapter 4 (p. 196) of Microsoft's _Developing Web Applications_ 2nd edition, by Jeff Web. For what I'm
0
1555
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 Page1.aspx Folder2 contains Page2.aspx
0
1456
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 "error executing child request" I can't seem to find any resolution to this issue. Many others have had this problem but their resolutions do not work for me.
0
1895
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 re-invoking your handler and producing a recursive relationship. The following describes an example of the recursive relationship. ________________________________ //snippet from web.config <httpHandlers>
1
8546
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. This property contains a string that hold the name of the page to which control is redirected, e.g. MyPage.aspx. In this scenario when the user clicks on the DataList item the handler either executes a Server.Transfer or a Response.Redirect. The...
21
7873
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
1658
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 works without issues but when false the error occures. In some of the cases I have managed to alter existing code to use Redirect but in some cases this is not practical without recoding a large number of pages that create a child object to be used...
2
2520
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. This same code works fine on another Win2003 Server machine, and a
0
3389
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 below. If Not Page.PreviousPage Is Nothing Then I cannot figure out why this error is occurring and wondered if anybody had any ideas. Below is the stack trace. Thanks.
0
9872
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9453
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7858
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5696
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4499
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4089
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3145
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.