473,699 Members | 2,417 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Server.Execute & HttpHandler

Sam
My problem is that when I am trying to use
Server.Execute( "Somehandler.as hx") I am getting HttpException.

[HttpException (0x80004005): Error executing child request for
Somehandler.ash x.]
System.Web.Http ServerUtility.E xecuteInternal( IHttpHandler handler,
TextWriter writer, Boolean preserveForm, Boolean setPreviousPage ,
VirtualPath path, VirtualPath filePath, String physPath, Exception
error, String queryStringOver ride) +3179617
System.Web.Http ServerUtility.E xecute(String path, TextWriter writer,
Boolean preserveForm) +747
System.Web.Http ServerUtility.T ransfer(String path, Boolean preserveForm) +56
System.Web.Http ServerUtility.T ransfer(String path) +26
Dec 16 '05 #1
6 4744
According to the documentation HttpServerUtilt y.Execute/Transfer only works
with pages... It simply may not work with handlers, because the redirect is
occurring from within the Page Handler framework. If you want to redirect to
a handler you need a physical redirect with Response.Redire ct().

+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog

"Sam" <fo*@tempuri.or g> wrote in message
news:uQ******** ******@TK2MSFTN GP11.phx.gbl...
My problem is that when I am trying to use
Server.Execute( "Somehandler.as hx") I am getting HttpException.

[HttpException (0x80004005): Error executing child request for
Somehandler.ash x.]
System.Web.Http ServerUtility.E xecuteInternal( IHttpHandler handler,
TextWriter writer, Boolean preserveForm, Boolean setPreviousPage ,
VirtualPath path, VirtualPath filePath, String physPath, Exception error,
String queryStringOver ride) +3179617
System.Web.Http ServerUtility.E xecute(String path, TextWriter writer,
Boolean preserveForm) +747
System.Web.Http ServerUtility.T ransfer(String path, Boolean preserveForm)
+56
System.Web.Http ServerUtility.T ransfer(String path) +26

Dec 16 '05 #2
Sam
Rick Strahl [MVP] wrote:
According to the documentation HttpServerUtilt y.Execute/Transfer only works
with pages... It simply may not work with handlers, because the redirect is
occurring from within the Page Handler framework. If you want to redirect to
a handler you need a physical redirect with Response.Redire ct().

+++ Rick ---


I need to save Context.Items and it's impossible to redirect. Anyway my
application need only Server.Execute.

Quote from documentation:

"Executes the handler for the specified virtual path in the context of
the current request."

I trust, there is no reason to prohibit IHttpHanlder derived classes.
See Reflected code of HttpServerUtili ty.ExecuteInter nal:

....
else if (!(handler is Page))
{
error = new HttpException(0 x194, string.Empty);
}
....
handler.Process Request(...) // BUT It's only for Page instances (((
....
object[] objArray2 = new object[] { handler.GetType ().ToString() } ;
throw new
HttpException(S R.GetString("Er ror_executing_c hild_request_fo r_handler",
objArray2), error);
Just remove this first 3 lines of code from assembly.. but I am not MS
employee :)
Dec 16 '05 #3
I believe that the issue is that .ashx files are handled by the
SimpleHandlerFa ctory while .aspx files are handled by the
PageHandlerFact ory. As Rick indicated in his post, the SimpleHandlerFa ctory
does not the redirect process that occurs with the transfer process because
this is embedded within the Page handler. It's not that the IHttpHandler is
prohibited; it's because the simple handler doesn't understand what a page
is necessarily.

Now, what are you trying to attempt using a simple handler file in place of
a page file?
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Sam" <fo*@tempuri.or g> wrote in message
news:OH******** ******@TK2MSFTN GP11.phx.gbl...
Rick Strahl [MVP] wrote:
According to the documentation HttpServerUtilt y.Execute/Transfer only
works with pages... It simply may not work with handlers, because the
redirect is occurring from within the Page Handler framework. If you want
to redirect to a handler you need a physical redirect with
Response.Redire ct().

+++ Rick ---


I need to save Context.Items and it's impossible to redirect. Anyway my
application need only Server.Execute.

Quote from documentation:

"Executes the handler for the specified virtual path in the context of the
current request."

I trust, there is no reason to prohibit IHttpHanlder derived classes.
See Reflected code of HttpServerUtili ty.ExecuteInter nal:

...
else if (!(handler is Page))
{
error = new HttpException(0 x194, string.Empty);
}
...
handler.Process Request(...) // BUT It's only for Page instances (((
...
object[] objArray2 = new object[] { handler.GetType ().ToString() } ;
throw new
HttpException(S R.GetString("Er ror_executing_c hild_request_fo r_handler",
objArray2), error);
Just remove this first 3 lines of code from assembly.. but I am not MS
employee :)

Dec 16 '05 #4
Sam
Christopher Reed wrote:
I believe that the issue is that .ashx files are handled by the
SimpleHandlerFa ctory while .aspx files are handled by the
PageHandlerFact ory. As Rick indicated in his post, the SimpleHandlerFa ctory
does not the redirect process that occurs with the transfer process because
this is embedded within the Page handler. It's not that the IHttpHandler is
prohibited; it's because the simple handler doesn't understand what a page
is necessarily.

Now, what are you trying to attempt using a simple handler file in place of
a page file?


It's not depended on Handler factories or something else. There is not
necessary ashx or aspx or jpg. It's a bug, and this bug must be fixed.
If method signature is: Server.Execute( IHttpHandler handler, ...) why I
have an exception here? Instead it there must be Server.Execute( Page
page,...) if handlers are prohibied. Is MS afraid that someone inherit
ASP.NET :)?

Please vote bugreport:

http://lab.msdn.microsoft.com/produc...a-e0dc82b43356
Dec 17 '05 #5
Sam
Rick Strahl [MVP] wrote:
According to the documentation HttpServerUtilt y.Execute/Transfer only works
with pages... It simply may not work with handlers, because the redirect is
occurring from within the Page Handler framework. If you want to redirect to
a handler you need a physical redirect with Response.Redire ct().

+++ Rick ---


I need to save Context.Items and it's impossible to direct redirect.
Anyway my
application need only Server.Execute.

Quote from documentation:

"Executes the handler for the specified virtual path in the context of
the current request."

I trust, there is no reason to prohibit IHttpHanlder derived classes.
See Reflected code of HttpServerUtili ty.ExecuteInter nal:

....
else if (!(handler is Page))
{
error = new HttpException(0 x194, string.Empty);
}
....
handler.Process Request(...) // BUT It's only for Page instances (((
....
object[] objArray2 = new object[] { handler.GetType ().ToString() } ;
throw new
HttpException(S R.GetString("Er ror_executing_c hild_request_fo r_handler",
objArray2), error);
Just remove this first 3 lines of code from assembly.. but I am not MS
employee :)

Next issue: Why I see the same behaviour with
Server.Execute( IHttphandler handler, ...)? Here is IHttpHandler as
method parameter.. and it don't work anyway. Why not System.Web.Page
instead of IHttpHandler, if handlers are prohibited? True is buried
within 3 lines above.

Quote from docs for HttpServerUtili ty.Execute(IHtt pHandler, TextWriter,
Boolean):
"Executes the current request by using a custom HTTP handler that
implements the IHttpHandler interface. A TextWriter object captures
output from the page and specifies whether to clear the QueryString and
Form collections."
Dec 17 '05 #6
Sam
Rick Strahl [MVP] wrote:
According to the documentation HttpServerUtilt y.Execute/Transfer only works
with pages... It simply may not work with handlers, because the redirect is
occurring from within the Page Handler framework. If you want to redirect to
a handler you need a physical redirect with Response.Redire ct().

+++ Rick ---


I need to save Context.Items and it's impossible to direct redirect.

Quote from documentation:

"Executes the handler for the specified virtual path in the context of
the current request."

I trust, there is no reason to prohibit IHttpHanlder derived classes.
See Reflected code of HttpServerUtili ty.ExecuteInter nal:

....
else if (!(handler is Page))
{
error = new HttpException(0 x194, string.Empty);
}
....
handler.Process Request(...) // BUT It's only for Page instances (((
....
object[] objArray2 = new object[] { handler.GetType ().ToString() } ;
throw new
HttpException(S R.GetString("Er ror_executing_c hild_request_fo r_handler",
objArray2), error);
Just remove this first 3 lines of code from assembly.. but I am not MS
employee :)

Next issue: Why I see the same behaviour with
Server.Execute( IHttphandler handler, ...)? Here is IHttpHandler as
method parameter.. and it don't work anyway. Why not System.Web.Page
instead of IHttpHandler, if handlers are prohibited? True is buried
within 3 lines above.

Quote from docs for HttpServerUtili ty.Execute(IHtt pHandler, TextWriter,
Boolean):
"Executes the current request by using a custom HTTP handler that
implements the IHttpHandler interface. A TextWriter object captures
output from the page and specifies whether to clear the QueryString and
Form collections."
Dec 17 '05 #7

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

Similar topics

0
2069
by: Srini | last post by:
I am implementing Front Controller in ASP.net as outlined in Microsoft documentation titled "Implementing Front Controller in ASP.NET Using HTTPHandler" (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpatterns/html/ImpFrontControllerInASP.asp Everything works well except for context.server.transfer(string url) method (refer to RedirectingCommand.cs class in the above documentation) Here are the error details Server...
1
2798
by: sathya | last post by:
hi, i have problem in httphandler, my problem is that when i am trying to use server.execute(/default.aspx) i am getting error.... Here i am trying to redirect from home.aspx to default.aspx (both file isin sharepoint).I have give a copy of my code below..
1
2332
by: sathya | last post by:
hi, i have problem in httphandler, my problem is that when i am trying to use server.execute(/default.aspx) i am getting error.... Here i am trying to redirect from home.aspx to default.aspx (both file isin sharepoint).I have give a copy of my code below..
3
1939
by: Steve Lutz | last post by:
Hello All, I have an ASPX page whose class inherits from a company global base page. The company base page has a property call PageTitle (string) that is assigned by all the pages. The base class also includes a class that is used for logging. This logging class uses HttpContext.Current.Handler to get the instance of the page. In this way, it can get the PageTitle property.
8
3897
by: bryan | last post by:
I've got a custom HttpHandler to process all requests for a given extension. It gets invoked OK, but if I try to do a Server.Transfer I get an HttpException. A Response.Redirect works, but I really need to avoid the extra round-trip to the client. I've tried Passing the page name, the full URL, and the instance of the handler class to the Transfer method, but everything gets me the same error 500. Any help would be appreciated.
3
6302
by: Jeeran | last post by:
I need to perform url rewriting to convert this (for example): /blogs/feeds/popular/posts/ to this: /blogs/feeds.aspx?type=popular&type2=posts What I did was the following: 1. Created an http handler that parses the url and based on it will execute another aspx page using Server.Execute
1
1850
by: Lopamudra | last post by:
Hi, I have implemented a HTTPHandler named ThumbnailGenerator.ashx to generate thumbnails for images. I have referenced this within my aspx file in the ImageUrl property of the Img control. When I debug the ashx page by setting it as the start page, the handler executes ( and also writes a debug line on the Application event log). But when I debug the aspx page, it sets the ImageUrl property and executes properly, but doesnt seem to...
1
2248
by: =?Utf-8?B?Y2hhaXJtYW4=?= | last post by:
I am trying to set up a Report Server to publish reports that I have created in Visual Studio 2005. I have been able to get it up and running and I am able to access reports via the web and set up another user. The other user can log on and see the reports available but when he runs then it begins to run the report then throws the error below. I have tried looking in the virus software logs to see if it is being blocked but that doesn't...
2
3038
by: Fernando Rodriguez | last post by:
I created an HttpHandler for rewritting URLs. It simply checks if the requested page is on a list of "special" pages (that do not exist) and if it is on the list then it will transfer to an ASPX page that will generate the content dynamically. The problem is that after the call to Server.Transfer or Server.Execute the page i'm transfering to throws an exception when it tries to access the Session object. The error says that I must set...
0
8613
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
9172
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8908
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
5869
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();...
0
4374
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
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3054
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
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
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.