473,779 Members | 1,913 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 8689
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
35136
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
1547
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
1453
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
1891
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
8540
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
7859
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
1650
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
2510
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
3387
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
9636
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...
0
9474
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10138
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10074
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,...
1
7485
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
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4037
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
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
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.