473,748 Members | 9,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom HttpHandler and Server.Transfer

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.Redire ct 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.

Thanks,
Bryan
Dec 24 '05 #1
8 3899
Hi Bryan,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 24 '05 #2
Hi Bryan,

As for ASP.NET's Server.Transfer method, it can only help forward request
between the pages or urls within the same asp.net webapplcation, we can not
use Server.Transfer to direct the current request to a resource in
different application or on other server. So what's the url you used in the
Server.Transfer ?

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: br***@newsgroup s.nospam
| Subject: Custom HttpHandler and Server.Transfer
| Date: Fri, 23 Dec 2005 20:27:01 -0600
| Message-ID: <6a************ *************** *****@4ax.com>
| X-Newsreader: Forte Agent 3.1/32.783
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
68.253.212.158
| Lines: 1
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3668 84
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| 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.Redire ct 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.
|
| Thanks,
| Bryan
|

Dec 26 '05 #3
Steven -
Thanks for the reply. The target of the Transfer is another page in
the same app that should be handled by the same custom handler. The
custom extension is set so that the handler gets invoked even if the
"pages" are not pesent, and there is in fact no physical page for the
target (nor is there for the source.)

Cheers,
Bryan

On Mon, 26 Dec 2005 03:48:16 GMT, st*****@online. microsoft.com (Steven
Cheng[MSFT]) wrote:
Hi Bryan,

As for ASP.NET's Server.Transfer method, it can only help forward request
between the pages or urls within the same asp.net webapplcation, we can not
use Server.Transfer to direct the current request to a resource in
different application or on other server. So what's the url you used in the
Server.Transfe r ?

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: br***@newsgroup s.nospam
| Subject: Custom HttpHandler and Server.Transfer
| Date: Fri, 23 Dec 2005 20:27:01 -0600
| Message-ID: <6a************ *************** *****@4ax.com>
| X-Newsreader: Forte Agent 3.1/32.783
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
68.253.212.1 58
| Lines: 1
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publ ic.dotnet.frame work.aspnet:366 884
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| 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.Redire ct 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.
|
| Thanks,
| Bryan
|

Dec 26 '05 #4
Hi Bryan,

Thanks for your response. I've just performed some further test according
to your scenario, I did reproduce the problem you encountered, and after
some further research, it seems due to the HttpServerUtili ty.Transfer
methods only addressing transfer to another Page handler, I've check the
related code and found that when the runtime found the target handler is
not a page hanlder, it'll throw exception....

So far, in addition to use Response.Redire ct, you can also have a look at
the HttpContext.Rew ritePath method which can help forward the internal
request to another resource in same application,e.g :

if(context.Requ est.QueryString["transfer"] != null)
{
context.Rewrite Path("test.sh?i d=aa&test=bb&as p=111");
}

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: br***@newsgroup s.nospam
| Subject: Re: Custom HttpHandler and Server.Transfer
| Date: Mon, 26 Dec 2005 08:59:31 -0600
| Message-ID: <e5************ *************** *****@4ax.com>
| References: <6a************ *************** *****@4ax.com>
<bB************ **@TK2MSFTNGXA0 2.phx.gbl>
| X-Newsreader: Forte Agent 3.1/32.783
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
68.253.212.158
| Lines: 1
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP14.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3670 58
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Steven -
| Thanks for the reply. The target of the Transfer is another page in
| the same app that should be handled by the same custom handler. The
| custom extension is set so that the handler gets invoked even if the
| "pages" are not pesent, and there is in fact no physical page for the
| target (nor is there for the source.)
|
| Cheers,
| Bryan
|
| On Mon, 26 Dec 2005 03:48:16 GMT, st*****@online. microsoft.com (Steven
| Cheng[MSFT]) wrote:
|
| >Hi Bryan,
| >
| >As for ASP.NET's Server.Transfer method, it can only help forward
request
| >between the pages or urls within the same asp.net webapplcation, we can
not
| >use Server.Transfer to direct the current request to a resource in
| >different application or on other server. So what's the url you used in
the
| >Server.Transfe r ?
| >
| >Regards,
| >
| >Steven Cheng
| >Microsoft Online Support
| >
| >Get Secure! www.microsoft.com/security
| >(This posting is provided "AS IS", with no warranties, and confers no
| >rights.)
| >
| >
| >--------------------
| >| From: br***@newsgroup s.nospam
| >| Subject: Custom HttpHandler and Server.Transfer
| >| Date: Fri, 23 Dec 2005 20:27:01 -0600
| >| Message-ID: <6a************ *************** *****@4ax.com>
| >| X-Newsreader: Forte Agent 3.1/32.783
| >| MIME-Version: 1.0
| >| Content-Type: text/plain; charset=us-ascii
| >| Content-Transfer-Encoding: 7bit
| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
| >68.253.212.1 58
| >| Lines: 1
| >| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| >| Xref: TK2MSFTNGXA02.p hx.gbl
| >microsoft.publ ic.dotnet.frame work.aspnet:366 884
| >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| >|
| >| 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.Redire ct 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.
| >|
| >| Thanks,
| >| Bryan
| >|
|

Dec 27 '05 #5
Steven-
Will rewrite path cause the transfer to handled entirely on the
server, or will it still cause anther round trip to the client and
back?

Thanks again for all the help.

Cheers,
Bryan

On Tue, 27 Dec 2005 05:24:45 GMT, st*****@online. microsoft.com (Steven
Cheng[MSFT]) wrote:
Hi Bryan,

Thanks for your response. I've just performed some further test according
to your scenario, I did reproduce the problem you encountered, and after
some further research, it seems due to the HttpServerUtili ty.Transfer
methods only addressing transfer to another Page handler, I've check the
related code and found that when the runtime found the target handler is
not a page hanlder, it'll throw exception....

So far, in addition to use Response.Redire ct, you can also have a look at
the HttpContext.Rew ritePath method which can help forward the internal
request to another resource in same application,e.g :

if(context.Requ est.QueryString["transfer"] != null)
{
context.Rewrite Path("test.sh?i d=aa&test=bb&as p=111");
}

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: br***@newsgroup s.nospam
| Subject: Re: Custom HttpHandler and Server.Transfer
| Date: Mon, 26 Dec 2005 08:59:31 -0600
| Message-ID: <e5************ *************** *****@4ax.com>
| References: <6a************ *************** *****@4ax.com>
<bB*********** ***@TK2MSFTNGXA 02.phx.gbl>
| X-Newsreader: Forte Agent 3.1/32.783
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
68.253.212.1 58
| Lines: 1
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP14.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publ ic.dotnet.frame work.aspnet:367 058
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Steven -
| Thanks for the reply. The target of the Transfer is another page in
| the same app that should be handled by the same custom handler. The
| custom extension is set so that the handler gets invoked even if the
| "pages" are not pesent, and there is in fact no physical page for the
| target (nor is there for the source.)
|
| Cheers,
| Bryan
|
| On Mon, 26 Dec 2005 03:48:16 GMT, st*****@online. microsoft.com (Steven
| Cheng[MSFT]) wrote:
|
| >Hi Bryan,
| >
| >As for ASP.NET's Server.Transfer method, it can only help forward
request
| >between the pages or urls within the same asp.net webapplcation, we can
not
| >use Server.Transfer to direct the current request to a resource in
| >different application or on other server. So what's the url you used in
the
| >Server.Transfe r ?
| >
| >Regards,
| >
| >Steven Cheng
| >Microsoft Online Support
| >
| >Get Secure! www.microsoft.com/security
| >(This posting is provided "AS IS", with no warranties, and confers no
| >rights.)
| >
| >
| >--------------------
| >| From: br***@newsgroup s.nospam
| >| Subject: Custom HttpHandler and Server.Transfer
| >| Date: Fri, 23 Dec 2005 20:27:01 -0600
| >| Message-ID: <6a************ *************** *****@4ax.com>
| >| X-Newsreader: Forte Agent 3.1/32.783
| >| MIME-Version: 1.0
| >| Content-Type: text/plain; charset=us-ascii
| >| Content-Transfer-Encoding: 7bit
| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
| >68.253.212.1 58
| >| Lines: 1
| >| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| >| Xref: TK2MSFTNGXA02.p hx.gbl
| >microsoft.publ ic.dotnet.frame work.aspnet:366 884
| >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| >|
| >| 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.Redire ct 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.
| >|
| >| Thanks,
| >| Bryan
| >|
|

Dec 27 '05 #6
Hi Bryan,

Of course Context.Rewrite Path is a serverside operation which change the
server side processing path for the current request. No roundtrip to client
(the browser's address bar will remain the original one....). Usuallly it
is used for Url Rewriting in asp.net application (to provide static look
url which is search engine friendly...). Here is a article discuss this:

#URL Rewriting in ASP.NET
http://msdn.microsoft.com/library/de...us/dnaspp/html
/urlrewriting.as p

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: br***@newsgroup s.nospam
| Subject: Re: Custom HttpHandler and Server.Transfer
| Date: Tue, 27 Dec 2005 07:37:55 -0600
| Message-ID: <6p************ *************** *****@4ax.com>
| References: <6a************ *************** *****@4ax.com>
<bB************ **@TK2MSFTNGXA0 2.phx.gbl>
<e5************ *************** *****@4ax.com>
<Nu************ **@TK2MSFTNGXA0 2.phx.gbl>
| X-Newsreader: Forte Agent 3.1/32.783
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
68.253.212.158
| Lines: 1
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3671 36
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Steven-
| Will rewrite path cause the transfer to handled entirely on the
| server, or will it still cause anther round trip to the client and
| back?
|
| Thanks again for all the help.
|
| Cheers,
| Bryan
|
| On Tue, 27 Dec 2005 05:24:45 GMT, st*****@online. microsoft.com (Steven
| Cheng[MSFT]) wrote:
|
| >Hi Bryan,
| >
| >Thanks for your response. I've just performed some further test
according
| >to your scenario, I did reproduce the problem you encountered, and after
| >some further research, it seems due to the HttpServerUtili ty.Transfer
| >methods only addressing transfer to another Page handler, I've check the
| >related code and found that when the runtime found the target handler is
| >not a page hanlder, it'll throw exception....
| >
| >So far, in addition to use Response.Redire ct, you can also have a look
at
| >the HttpContext.Rew ritePath method which can help forward the internal
| >request to another resource in same application,e.g :
| >
| > if(context.Requ est.QueryString["transfer"] != null)
| > {
| > context.Rewrite Path("test.sh?i d=aa&test=bb&as p=111");
| > }
| >
| >Thanks & Regards,
| >
| >Steven Cheng
| >Microsoft Online Support
| >
| >Get Secure! www.microsoft.com/security
| >(This posting is provided "AS IS", with no warranties, and confers no
| >rights.)
| >
| >
| >--------------------
| >| From: br***@newsgroup s.nospam
| >| Subject: Re: Custom HttpHandler and Server.Transfer
| >| Date: Mon, 26 Dec 2005 08:59:31 -0600
| >| Message-ID: <e5************ *************** *****@4ax.com>
| >| References: <6a************ *************** *****@4ax.com>
| ><bB*********** ***@TK2MSFTNGXA 02.phx.gbl>
| >| X-Newsreader: Forte Agent 3.1/32.783
| >| MIME-Version: 1.0
| >| Content-Type: text/plain; charset=us-ascii
| >| Content-Transfer-Encoding: 7bit
| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
| >68.253.212.1 58
| >| Lines: 1
| >| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP14.phx. gbl
| >| Xref: TK2MSFTNGXA02.p hx.gbl
| >microsoft.publ ic.dotnet.frame work.aspnet:367 058
| >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| >|
| >| Steven -
| >| Thanks for the reply. The target of the Transfer is another page in
| >| the same app that should be handled by the same custom handler. The
| >| custom extension is set so that the handler gets invoked even if the
| >| "pages" are not pesent, and there is in fact no physical page for the
| >| target (nor is there for the source.)
| >|
| >| Cheers,
| >| Bryan
| >|
| >| On Mon, 26 Dec 2005 03:48:16 GMT, st*****@online. microsoft.com (Steven
| >| Cheng[MSFT]) wrote:
| >|
| >| >Hi Bryan,
| >| >
| >| >As for ASP.NET's Server.Transfer method, it can only help forward
| >request
| >| >between the pages or urls within the same asp.net webapplcation, we
can
| >not
| >| >use Server.Transfer to direct the current request to a resource in
| >| >different application or on other server. So what's the url you used
in
| >the
| >| >Server.Transfe r ?
| >| >
| >| >Regards,
| >| >
| >| >Steven Cheng
| >| >Microsoft Online Support
| >| >
| >| >Get Secure! www.microsoft.com/security
| >| >(This posting is provided "AS IS", with no warranties, and confers no
| >| >rights.)
| >| >
| >| >
| >| >--------------------
| >| >| From: br***@newsgroup s.nospam
| >| >| Subject: Custom HttpHandler and Server.Transfer
| >| >| Date: Fri, 23 Dec 2005 20:27:01 -0600
| >| >| Message-ID: <6a************ *************** *****@4ax.com>
| >| >| X-Newsreader: Forte Agent 3.1/32.783
| >| >| MIME-Version: 1.0
| >| >| Content-Type: text/plain; charset=us-ascii
| >| >| Content-Transfer-Encoding: 7bit
| >| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| >| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
| >| >68.253.212.1 58
| >| >| Lines: 1
| >| >| Path:
TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| >| >| Xref: TK2MSFTNGXA02.p hx.gbl
| >| >microsoft.publ ic.dotnet.frame work.aspnet:366 884
| >| >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| >| >|
| >| >| 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.Redire ct 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.
| >| >|
| >| >| Thanks,
| >| >| Bryan
| >| >|
| >|
|

Dec 28 '05 #7
Steven -
RewritePath won't work. My custom handler is associated with an
extension that does not require the actual files to be present. So I
rewrite the path, but there is no page there, so an empty file is
getting returned. I don't see my custom handler getting invoked on the
RewritePath call, but I have not had the chance to digg too deeply
into this.

-Bryan

On Wed, 28 Dec 2005 01:25:09 GMT, st*****@online. microsoft.com (Steven
Cheng[MSFT]) wrote:
Hi Bryan,

Of course Context.Rewrite Path is a serverside operation which change the
server side processing path for the current request. No roundtrip to client
(the browser's address bar will remain the original one....). Usuallly it
is used for Url Rewriting in asp.net application (to provide static look
url which is search engine friendly...). Here is a article discuss this:

#URL Rewriting in ASP.NET
http://msdn.microsoft.com/library/de...us/dnaspp/html
/urlrewriting.as p

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: br***@newsgroup s.nospam
| Subject: Re: Custom HttpHandler and Server.Transfer
| Date: Tue, 27 Dec 2005 07:37:55 -0600
| Message-ID: <6p************ *************** *****@4ax.com>
| References: <6a************ *************** *****@4ax.com>
<bB*********** ***@TK2MSFTNGXA 02.phx.gbl>
<e5*********** *************** ******@4ax.com>
<Nu*********** ***@TK2MSFTNGXA 02.phx.gbl>
| X-Newsreader: Forte Agent 3.1/32.783
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
68.253.212.1 58
| Lines: 1
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publ ic.dotnet.frame work.aspnet:367 136
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Steven-
| Will rewrite path cause the transfer to handled entirely on the
| server, or will it still cause anther round trip to the client and
| back?
|
| Thanks again for all the help.
|
| Cheers,
| Bryan
|
| On Tue, 27 Dec 2005 05:24:45 GMT, st*****@online. microsoft.com (Steven
| Cheng[MSFT]) wrote:
|
| >Hi Bryan,
| >
| >Thanks for your response. I've just performed some further test
according
| >to your scenario, I did reproduce the problem you encountered, and after
| >some further research, it seems due to the HttpServerUtili ty.Transfer
| >methods only addressing transfer to another Page handler, I've check the
| >related code and found that when the runtime found the target handler is
| >not a page hanlder, it'll throw exception....
| >
| >So far, in addition to use Response.Redire ct, you can also have a look
at
| >the HttpContext.Rew ritePath method which can help forward the internal
| >request to another resource in same application,e.g :
| >
| > if(context.Requ est.QueryString["transfer"] != null)
| > {
| > context.Rewrite Path("test.sh?i d=aa&test=bb&as p=111");
| > }
| >
| >Thanks & Regards,
| >
| >Steven Cheng
| >Microsoft Online Support
| >
| >Get Secure! www.microsoft.com/security
| >(This posting is provided "AS IS", with no warranties, and confers no
| >rights.)
| >
| >
| >--------------------
| >| From: br***@newsgroup s.nospam
| >| Subject: Re: Custom HttpHandler and Server.Transfer
| >| Date: Mon, 26 Dec 2005 08:59:31 -0600
| >| Message-ID: <e5************ *************** *****@4ax.com>
| >| References: <6a************ *************** *****@4ax.com>
| ><bB*********** ***@TK2MSFTNGXA 02.phx.gbl>
| >| X-Newsreader: Forte Agent 3.1/32.783
| >| MIME-Version: 1.0
| >| Content-Type: text/plain; charset=us-ascii
| >| Content-Transfer-Encoding: 7bit
| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
| >68.253.212.1 58
| >| Lines: 1
| >| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP14.phx. gbl
| >| Xref: TK2MSFTNGXA02.p hx.gbl
| >microsoft.publ ic.dotnet.frame work.aspnet:367 058
| >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| >|
| >| Steven -
| >| Thanks for the reply. The target of the Transfer is another page in
| >| the same app that should be handled by the same custom handler. The
| >| custom extension is set so that the handler gets invoked even if the
| >| "pages" are not pesent, and there is in fact no physical page for the
| >| target (nor is there for the source.)
| >|
| >| Cheers,
| >| Bryan
| >|
| >| On Mon, 26 Dec 2005 03:48:16 GMT, st*****@online. microsoft.com (Steven
| >| Cheng[MSFT]) wrote:
| >|
| >| >Hi Bryan,
| >| >
| >| >As for ASP.NET's Server.Transfer method, it can only help forward
| >request
| >| >between the pages or urls within the same asp.net webapplcation, we
can
| >not
| >| >use Server.Transfer to direct the current request to a resource in
| >| >different application or on other server. So what's the url you used
in
| >the
| >| >Server.Transfe r ?
| >| >
| >| >Regards,
| >| >
| >| >Steven Cheng
| >| >Microsoft Online Support
| >| >
| >| >Get Secure! www.microsoft.com/security
| >| >(This posting is provided "AS IS", with no warranties, and confers no
| >| >rights.)
| >| >
| >| >
| >| >--------------------
| >| >| From: br***@newsgroup s.nospam
| >| >| Subject: Custom HttpHandler and Server.Transfer
| >| >| Date: Fri, 23 Dec 2005 20:27:01 -0600
| >| >| Message-ID: <6a************ *************** *****@4ax.com>
| >| >| X-Newsreader: Forte Agent 3.1/32.783
| >| >| MIME-Version: 1.0
| >| >| Content-Type: text/plain; charset=us-ascii
| >| >| Content-Transfer-Encoding: 7bit
| >| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| >| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
| >| >68.253.212.1 58
| >| >| Lines: 1
| >| >| Path:
TK2MSFTNGXA02. phx.gbl!TK2MSFT NGP08.phx.gbl!T K2MSFTNGP12.phx .gbl
| >| >| Xref: TK2MSFTNGXA02.p hx.gbl
| >| >microsoft.publ ic.dotnet.frame work.aspnet:366 884
| >| >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| >| >|
| >| >| 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.Redire ct 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.
| >| >|
| >| >| Thanks,
| >| >| Bryan
| >| >|
| >|
|

Dec 29 '05 #8
Thanks for your Bryan,

I'm sorry for the HttpContext.Rew ritePath, I've rechecked it and it won't
work in handler's ProcessRequest method (it's too later at that time...),
generally it is used in some intial events in the asp.net pipeline like
(BeginRequest.. ...)....

And for Server.Transfer , I've consult our dev engineer and seems it is a by
design limitation that Server.Transfer can only be used to redirect to a
page handler. Here is the original description from the dev guys:

=============== ===
Server.Transfer means ¡®execute this request using another handler¡¯ which
works fine
for pages because pages have handler per URL. In case of web services (and
other
handler factories) we get the same handler for all URLs and thus
Server.Transfer
would lead to infinite recursion.
So it really only works for pages.
=============== ===

So far I think we may need to use response.Redire ct for such redircting....

Thanks for your understanding,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: br***@newsgroup s.nospam
| Subject: Re: Custom HttpHandler and Server.Transfer
| Date: Thu, 29 Dec 2005 09:19:35 -0600
| Message-ID: <kg************ *************** *****@4ax.com>
| References: <6a************ *************** *****@4ax.com>
<bB************ **@TK2MSFTNGXA0 2.phx.gbl>
<e5************ *************** *****@4ax.com>
<Nu************ **@TK2MSFTNGXA0 2.phx.gbl>
<6p************ *************** *****@4ax.com>
<DH************ **@TK2MSFTNGXA0 2.phx.gbl>
| X-Newsreader: Forte Agent 3.1/32.783
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
68.253.212.158
| Lines: 1
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP10.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3675 34
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Steven -
| RewritePath won't work. My custom handler is associated with an
| extension that does not require the actual files to be present. So I
| rewrite the path, but there is no page there, so an empty file is
| getting returned. I don't see my custom handler getting invoked on the
| RewritePath call, but I have not had the chance to digg too deeply
| into this.
|
| -Bryan
|
| On Wed, 28 Dec 2005 01:25:09 GMT, st*****@online. microsoft.com (Steven
| Cheng[MSFT]) wrote:
|
| >Hi Bryan,
| >
| >Of course Context.Rewrite Path is a serverside operation which change the
| >server side processing path for the current request. No roundtrip to
client
| >(the browser's address bar will remain the original one....). Usuallly
it
| >is used for Url Rewriting in asp.net application (to provide static look
| >url which is search engine friendly...). Here is a article discuss this:
| >
| >#URL Rewriting in ASP.NET
|
http://msdn.microsoft.com/library/de...-us/dnaspp/htm

l
| >/urlrewriting.as p
| >
| >Regards,
| >
| >Steven Cheng
| >Microsoft Online Support
| >
| >Get Secure! www.microsoft.com/security
| >(This posting is provided "AS IS", with no warranties, and confers no
| >rights.)
| >
| >--------------------
| >| From: br***@newsgroup s.nospam
| >| Subject: Re: Custom HttpHandler and Server.Transfer
| >| Date: Tue, 27 Dec 2005 07:37:55 -0600
| >| Message-ID: <6p************ *************** *****@4ax.com>
| >| References: <6a************ *************** *****@4ax.com>
| ><bB*********** ***@TK2MSFTNGXA 02.phx.gbl>
| ><e5*********** *************** ******@4ax.com>
| ><Nu*********** ***@TK2MSFTNGXA 02.phx.gbl>
| >| X-Newsreader: Forte Agent 3.1/32.783
| >| MIME-Version: 1.0
| >| Content-Type: text/plain; charset=us-ascii
| >| Content-Transfer-Encoding: 7bit
| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
| >68.253.212.1 58
| >| Lines: 1
| >| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
| >| Xref: TK2MSFTNGXA02.p hx.gbl
| >microsoft.publ ic.dotnet.frame work.aspnet:367 136
| >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| >|
| >| Steven-
| >| Will rewrite path cause the transfer to handled entirely on the
| >| server, or will it still cause anther round trip to the client and
| >| back?
| >|
| >| Thanks again for all the help.
| >|
| >| Cheers,
| >| Bryan
| >|
| >| On Tue, 27 Dec 2005 05:24:45 GMT, st*****@online. microsoft.com (Steven
| >| Cheng[MSFT]) wrote:
| >|
| >| >Hi Bryan,
| >| >
| >| >Thanks for your response. I've just performed some further test
| >according
| >| >to your scenario, I did reproduce the problem you encountered, and
after
| >| >some further research, it seems due to the HttpServerUtili ty.Transfer
| >| >methods only addressing transfer to another Page handler, I've check
the
| >| >related code and found that when the runtime found the target handler
is
| >| >not a page hanlder, it'll throw exception....
| >| >
| >| >So far, in addition to use Response.Redire ct, you can also have a
look
| >at
| >| >the HttpContext.Rew ritePath method which can help forward the
internal
| >| >request to another resource in same application,e.g :
| >| >
| >| > if(context.Requ est.QueryString["transfer"] != null)
| >| > {
| >| > context.Rewrite Path("test.sh?i d=aa&test=bb&as p=111");
| >| > }
| >| >
| >| >Thanks & Regards,
| >| >
| >| >Steven Cheng
| >| >Microsoft Online Support
| >| >
| >| >Get Secure! www.microsoft.com/security
| >| >(This posting is provided "AS IS", with no warranties, and confers no
| >| >rights.)
| >| >
| >| >
| >| >--------------------
| >| >| From: br***@newsgroup s.nospam
| >| >| Subject: Re: Custom HttpHandler and Server.Transfer
| >| >| Date: Mon, 26 Dec 2005 08:59:31 -0600
| >| >| Message-ID: <e5************ *************** *****@4ax.com>
| >| >| References: <6a************ *************** *****@4ax.com>
| >| ><bB*********** ***@TK2MSFTNGXA 02.phx.gbl>
| >| >| X-Newsreader: Forte Agent 3.1/32.783
| >| >| MIME-Version: 1.0
| >| >| Content-Type: text/plain; charset=us-ascii
| >| >| Content-Transfer-Encoding: 7bit
| >| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| >| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
| >| >68.253.212.1 58
| >| >| Lines: 1
| >| >| Path:
TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP14.phx. gbl
| >| >| Xref: TK2MSFTNGXA02.p hx.gbl
| >| >microsoft.publ ic.dotnet.frame work.aspnet:367 058
| >| >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| >| >|
| >| >| Steven -
| >| >| Thanks for the reply. The target of the Transfer is another page
in
| >| >| the same app that should be handled by the same custom handler. The
| >| >| custom extension is set so that the handler gets invoked even if the
| >| >| "pages" are not pesent, and there is in fact no physical page for
the
| >| >| target (nor is there for the source.)
| >| >|
| >| >| Cheers,
| >| >| Bryan
| >| >|
| >| >| On Mon, 26 Dec 2005 03:48:16 GMT, st*****@online. microsoft.com
(Steven
| >| >| Cheng[MSFT]) wrote:
| >| >|
| >| >| >Hi Bryan,
| >| >| >
| >| >| >As for ASP.NET's Server.Transfer method, it can only help forward
| >| >request
| >| >| >between the pages or urls within the same asp.net webapplcation,
we
| >can
| >| >not
| >| >| >use Server.Transfer to direct the current request to a resource in
| >| >| >different application or on other server. So what's the url you
used
| >in
| >| >the
| >| >| >Server.Transfe r ?
| >| >| >
| >| >| >Regards,
| >| >| >
| >| >| >Steven Cheng
| >| >| >Microsoft Online Support
| >| >| >
| >| >| >Get Secure! www.microsoft.com/security
| >| >| >(This posting is provided "AS IS", with no warranties, and confers
no
| >| >| >rights.)
| >| >| >
| >| >| >
| >| >| >--------------------
| >| >| >| From: br***@newsgroup s.nospam
| >| >| >| Subject: Custom HttpHandler and Server.Transfer
| >| >| >| Date: Fri, 23 Dec 2005 20:27:01 -0600
| >| >| >| Message-ID: <6a************ *************** *****@4ax.com>
| >| >| >| X-Newsreader: Forte Agent 3.1/32.783
| >| >| >| MIME-Version: 1.0
| >| >| >| Content-Type: text/plain; charset=us-ascii
| >| >| >| Content-Transfer-Encoding: 7bit
| >| >| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| >| >| NNTP-Posting-Host: adsl-68-253-212-158.dsl.emhril. ameritech.net
| >| >| >68.253.212.1 58
| >| >| >| Lines: 1
| >| >| >| Path:
| >TK2MSFTNGXA02. phx.gbl!TK2MSFT NGP08.phx.gbl!T K2MSFTNGP12.phx .gbl
| >| >| >| Xref: TK2MSFTNGXA02.p hx.gbl
| >| >| >microsoft.publ ic.dotnet.frame work.aspnet:366 884
| >| >| >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| >| >| >|
| >| >| >| 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.Redire ct 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.
| >| >| >|
| >| >| >| Thanks,
| >| >| >| Bryan
| >| >| >|
| >| >|
| >|
|

Dec 30 '05 #9

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

Similar topics

2
2428
by: Stanislav Ostachevski | last post by:
Hello, My app needs to map calls to "virtual files" to ASPX parametrized pages, without showing user actual page address. I.e, I want to catch calls to http://myserver.com/products/id_product/somefeature.ashx and redirect them to http://products.myserver.com/product.aspx?id=id_product&features=.... but I don't want to reveal the actual URL of product.aspx I catch all calls to ashx files by custom HTTP handler.
3
3757
by: Michael Iantosca | last post by:
I have a custom attribute that I attach to certain pages in my application and I want to inspect each page request as it is made to see if the custom attribute is attached to the underlying page class. If is attached I want to perform some action. How can I access custom attributes from an HttpModule? I have to pass a target to the System.Attribute.GetCustomAttribute() call to attempt to retrieve the attached attribute. I tried to access...
3
7971
by: Jed | last post by:
I have written an HttpHandler which I invoke through an ashx page. The HttpHandler does various things to process the request, then it is supposed to redirect to a confirmation page. Everything up to the redirect works fine, but I can't get the redirect to work. If I do a ... context.Response.Write("Hello World"); .... the HttpHandler works great and the browser loads the text fine, but if I change it to ...
1
2336
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..
7
2918
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*" path="*.sgf" type="CustomExtensionHandler, Extenders.CustomExtensionHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d831d925597c1031" validate="True"/> </httpHandlers>
0
1153
by: Mutley | last post by:
Hi All, I have a custom HttpHandler that handles requests for pages with my custom file extension of sfdl. Within the ProcessRequest method of the custom handler I want then to getthe page. I currently do this by making a call to the method GetCompiledPageInstance of the PageParser class. I have been trying to get information on the advantages\disadvantages of using GetCompiledPageInstance instead of using Server.transfer,...
1
2028
by: henke.lundin | last post by:
Hello, I am having problems with Server.Transfer(string, bool) in the ProcessRequest method of a custom HTTP handler. I get the "Error executing child request" error message. The page that I am trying to transfer to is mapped to the same custom handler. Does anyone know why this occurs? Does the Server.Transfer method assume that the target page is mapped to the default aspx Page HTTP handler?
5
7306
by: Author | last post by:
I followed the example at http://support.microsoft.com/kb/308001/EN-US/ and created my own HttpHandler. Here is the code: using System.Web; namespace MyNameSpace { public class SyncHttpHandler: IHttpHandler
3
3213
by: Tomasz J | last post by:
Hello Developers, I have a following problem: I need to write a HttpHandler rewriting requests like: /Resource.axd?resid=1 to /someimage.gif My HttpHandler is listed in the web.config, its ProcessRequest() method gets called but I cannot get it to work. If within IHttpHandler.ProcessRequest() method instead of RewritePath() method I use Server.Transfer() it works in IE but FireFox instead of images
0
8989
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
8828
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
9537
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...
0
9367
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
9319
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
8241
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...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2213
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.