HttpContext.RewritePath with different servers

G

Guest

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!
 
S

Steven Cheng[MSFT]

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=?=" <[email protected]>
| Subject: HttpContext.RewritePath with different servers
| Date: Wed, 16 Nov 2005 15:38:13 -0800
| Lines: 14
| Message-ID: <[email protected]>
| 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!TK2MSFTNGXA03.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!
|
 
S

Steven Cheng[MSFT]

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=?=" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: HttpContext.RewritePath with different servers
| Date: Thu, 17 Nov 2005 04:41:11 -0800
| Lines: 70
| Message-ID: <[email protected]>
| 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!TK2MSFTNGXA03.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=?=" <[email protected]>
| > | Subject: HttpContext.RewritePath with different servers
| > | Date: Wed, 16 Nov 2005 15:38:13 -0800
| > | Lines: 14
| > | Message-ID: <[email protected]>
| > | 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!TK2MSFTNGXA03.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!
| > |
| >
| >
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top