By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,995 Members | 1,195 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,995 IT Pros & Developers. It's quick & easy.

HttpContext.RewritePath with different servers

P: n/a
I want to create an ASP.NET web application that receives a form POST
message, inspects the data, and reroutes the request to one of many different
servers. I wrote an IHttpModule which successfully used
HttpContext.RewritePath() to send a request to different pages in one web
application, but it gives me an error when I try to rewrite a path to a
different web app or server. Does RewritePath() not support this?

I can reroute by sending back a 307 temporary redirect, but that requires
another round trip and also requires the client to re-issue the request. I
can also issue a new request from my rerouting application to the target
server, but that seems more cumbersome, and also doesn't seem to take
advantage of caching (at least not as well as the 307 redirect does.)

Thanks!
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Asanford,

As for the HttpContext.RewritePath method, it is only allowed rewite the
current comming request to another file within the same asp.net web
application. As we can find in the MSDN document, the first parameter
(filePath) point to a internal path.... This is the same as
Server.Transfer... Only client redirection like Response.Redirect can
make redirection to external url resource...

Thanks,

Steven Cheng
Microsoft Online Support

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


--------------------
| Thread-Topic: HttpContext.RewritePath with different servers
| thread-index: AcXrBs+fJ+qWP1NcScWTNBR7r1Nvxg==
| X-WBNR-Posting-Host: 65.211.107.162
| From: "=?Utf-8?B?YXNhbmZvcmQ=?=" <as**********@hotmail.com>
| Subject: HttpContext.RewritePath with different servers
| Date: Wed, 16 Nov 2005 15:38:13 -0800
| Lines: 14
| Message-ID: <1C**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:358782
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I want to create an ASP.NET web application that receives a form POST
| message, inspects the data, and reroutes the request to one of many
different
| servers. I wrote an IHttpModule which successfully used
| HttpContext.RewritePath() to send a request to different pages in one web
| application, but it gives me an error when I try to rewrite a path to a
| different web app or server. Does RewritePath() not support this?
|
| I can reroute by sending back a 307 temporary redirect, but that
requires
| another round trip and also requires the client to re-issue the request.
I
| can also issue a new request from my rerouting application to the target
| server, but that seems more cumbersome, and also doesn't seem to take
| advantage of caching (at least not as well as the 307 redirect does.)
|
| Thanks!
|

Nov 20 '05 #2

P: n/a
OK; thanks for your help, Steven! Much appreciated.

"Steven Cheng[MSFT]" wrote:
Hi Asanford,

As for the HttpContext.RewritePath method, it is only allowed rewite the
current comming request to another file within the same asp.net web
application. As we can find in the MSDN document, the first parameter
(filePath) point to a internal path.... This is the same as
Server.Transfer... Only client redirection like Response.Redirect can
make redirection to external url resource...

Thanks,

Steven Cheng
Microsoft Online Support

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


--------------------
| Thread-Topic: HttpContext.RewritePath with different servers
| thread-index: AcXrBs+fJ+qWP1NcScWTNBR7r1Nvxg==
| X-WBNR-Posting-Host: 65.211.107.162
| From: "=?Utf-8?B?YXNhbmZvcmQ=?=" <as**********@hotmail.com>
| Subject: HttpContext.RewritePath with different servers
| Date: Wed, 16 Nov 2005 15:38:13 -0800
| Lines: 14
| Message-ID: <1C**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:358782
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I want to create an ASP.NET web application that receives a form POST
| message, inspects the data, and reroutes the request to one of many
different
| servers. I wrote an IHttpModule which successfully used
| HttpContext.RewritePath() to send a request to different pages in one web
| application, but it gives me an error when I try to rewrite a path to a
| different web app or server. Does RewritePath() not support this?
|
| I can reroute by sending back a 307 temporary redirect, but that
requires
| another round trip and also requires the client to re-issue the request.
I
| can also issue a new request from my rerouting application to the target
| server, but that seems more cumbersome, and also doesn't seem to take
| advantage of caching (at least not as well as the 307 redirect does.)
|
| Thanks!
|

Nov 20 '05 #3

P: n/a
My pleasure Asanford,

Please feel free to post here when there is anything else we can help.

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.)
--------------------
| Thread-Topic: HttpContext.RewritePath with different servers
| thread-index: AcXrdDCb8BiQKkS3SPi5LKXH1riQYQ==
| X-WBNR-Posting-Host: 65.211.107.162
| From: "=?Utf-8?B?YXNhbmZvcmQ=?=" <as**********@hotmail.com>
| References: <1C**********************************@microsoft.co m>
<1O**************@TK2MSFTNGXA02.phx.gbl>
| Subject: RE: HttpContext.RewritePath with different servers
| Date: Thu, 17 Nov 2005 04:41:11 -0800
| Lines: 70
| Message-ID: <D0**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:358873
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| OK; thanks for your help, Steven! Much appreciated.
|
| "Steven Cheng[MSFT]" wrote:
|
| > Hi Asanford,
| >
| > As for the HttpContext.RewritePath method, it is only allowed rewite
the
| > current comming request to another file within the same asp.net web
| > application. As we can find in the MSDN document, the first parameter
| > (filePath) point to a internal path.... This is the same as
| > Server.Transfer... Only client redirection like Response.Redirect can
| > make redirection to external url resource...
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| > --------------------
| > | Thread-Topic: HttpContext.RewritePath with different servers
| > | thread-index: AcXrBs+fJ+qWP1NcScWTNBR7r1Nvxg==
| > | X-WBNR-Posting-Host: 65.211.107.162
| > | From: "=?Utf-8?B?YXNhbmZvcmQ=?=" <as**********@hotmail.com>
| > | Subject: HttpContext.RewritePath with different servers
| > | Date: Wed, 16 Nov 2005 15:38:13 -0800
| > | Lines: 14
| > | Message-ID: <1C**********************************@microsoft.co m>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:358782
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | I want to create an ASP.NET web application that receives a form POST
| > | message, inspects the data, and reroutes the request to one of many
| > different
| > | servers. I wrote an IHttpModule which successfully used
| > | HttpContext.RewritePath() to send a request to different pages in one
web
| > | application, but it gives me an error when I try to rewrite a path to
a
| > | different web app or server. Does RewritePath() not support this?
| > |
| > | I can reroute by sending back a 307 temporary redirect, but that
| > requires
| > | another round trip and also requires the client to re-issue the
request.
| > I
| > | can also issue a new request from my rerouting application to the
target
| > | server, but that seems more cumbersome, and also doesn't seem to take
| > | advantage of caching (at least not as well as the 307 redirect does.)
| > |
| > | Thanks!
| > |
| >
| >
|

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.