473,770 Members | 4,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HttpContext.Rew ritePath with different servers

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.Rew ritePath() 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
3 2946
Hi Asanford,

As for the HttpContext.Rew ritePath 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.Redire ct 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.Rew ritePath with different servers
| thread-index: AcXrBs+fJ+qWP1N cScWTNBR7r1Nvxg ==
| X-WBNR-Posting-Host: 65.211.107.162
| From: "=?Utf-8?B?YXNhbmZvcmQ =?=" <as**********@h otmail.com>
| Subject: HttpContext.Rew ritePath with different servers
| Date: Wed, 16 Nov 2005 15:38:13 -0800
| Lines: 14
| Message-ID: <1C************ *************** *******@microso ft.com>
| 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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGXA03.phx .gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3587 82
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.Rew ritePath() 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
OK; thanks for your help, Steven! Much appreciated.

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

As for the HttpContext.Rew ritePath 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.Redire ct 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.Rew ritePath with different servers
| thread-index: AcXrBs+fJ+qWP1N cScWTNBR7r1Nvxg ==
| X-WBNR-Posting-Host: 65.211.107.162
| From: "=?Utf-8?B?YXNhbmZvcmQ =?=" <as**********@h otmail.com>
| Subject: HttpContext.Rew ritePath with different servers
| Date: Wed, 16 Nov 2005 15:38:13 -0800
| Lines: 14
| Message-ID: <1C************ *************** *******@microso ft.com>
| 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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGXA03.phx .gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3587 82
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.Rew ritePath() 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
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.Rew ritePath with different servers
| thread-index: AcXrdDCb8BiQKkS 3SPi5LKXH1riQYQ ==
| X-WBNR-Posting-Host: 65.211.107.162
| From: "=?Utf-8?B?YXNhbmZvcmQ =?=" <as**********@h otmail.com>
| References: <1C************ *************** *******@microso ft.com>
<1O************ **@TK2MSFTNGXA0 2.phx.gbl>
| Subject: RE: HttpContext.Rew ritePath with different servers
| Date: Thu, 17 Nov 2005 04:41:11 -0800
| Lines: 70
| Message-ID: <D0************ *************** *******@microso ft.com>
| 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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGXA03.phx .gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3588 73
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| OK; thanks for your help, Steven! Much appreciated.
|
| "Steven Cheng[MSFT]" wrote:
|
| > Hi Asanford,
| >
| > As for the HttpContext.Rew ritePath 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.Redire ct 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.Rew ritePath with different servers
| > | thread-index: AcXrBs+fJ+qWP1N cScWTNBR7r1Nvxg ==
| > | X-WBNR-Posting-Host: 65.211.107.162
| > | From: "=?Utf-8?B?YXNhbmZvcmQ =?=" <as**********@h otmail.com>
| > | Subject: HttpContext.Rew ritePath with different servers
| > | Date: Wed, 16 Nov 2005 15:38:13 -0800
| > | Lines: 14
| > | Message-ID: <1C************ *************** *******@microso ft.com>
| > | 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.publi c.dotnet.framew ork.aspnet
| > | NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGXA03.phx .gbl
| > | Xref: TK2MSFTNGXA02.p hx.gbl
| > microsoft.publi c.dotnet.framew ork.aspnet:3587 82
| > | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.Rew ritePath() 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2773
by: Guadala Harry | last post by:
I'd really appreciate it if someone would give me a"plain English" explanation of HttpContext.RewritePath(). I read the MSDN documentation, but still don't understand it. According to MSDN: .... assigns an internal rewrite path. RewritePath allows for the URL that is requested to differ from the internal path to the resource. What does this mean? When would it be useful to have the paths differ ?
8
1868
by: Jiho Han | last post by:
Can someone explain in layman's term, what HttpContext.RewritePath does? SDK doc explanation is kind of scant. Does it only affect the request processing for the duration of the processing(meaning server side), or is the client in anyway affected? Thanks
1
1652
by: marcmiles | last post by:
It looks like postbacks cause a problem with HttpContext.RewritePath. I've read about the two solutions below, but the first one seems extensive, and the scond one seems too easy. I sent an email to the author of the second one for more info.......but no reply. http://weblogs.asp.net/jezell/archive/2004/03/15/90045.aspx http://www.hanselman.com/blog/CommentView,guid,9059256e-fa67-4dc7-9144-8ff35d7f36cb.aspx
15
6746
by: James Higgs | last post by:
For a long time, our product has had a "vanity URLs" feature where nice URLs are mapped to ASPX files in an IHttpModule implementation, using HttpContext.RewritePath(). This has worked beautifully for the past couple of years under .NET 1.1, but when it runs under ASP.NET 2.0 it has problems. Note that this is the case regardless of whether the assmbly is built against 1.1 or 2.0 We're getting the following exception stack trace: ...
0
1451
by: cpnet | last post by:
I was playing around with Beta 2 of VS2005, .NET 2.0, and built an IHttpModule do allow me to have nice URL's in my web app. It was working great. I had a URL like: http://mydomain.com/Users/BobSmith/ or http://mydomain.com/Users/BobSmith The "BobSmith" didn't actually exist. My HttpModule would use RewritePath method to return a page from:
0
1389
by: Martin | last post by:
asp.net 2.0 I have implemented the url rewriting using httpcontext.rewrite path( newpath, setbase) which all works fine in IE, but testing with fiddler ( www.fiddlertool.com) when you test Mozilla 5.0 UserAgent - it generates a http 500 error. This is bad because none of those pages will get indexed by google or Yahoo etc and any other browser type which is effected by this bug. Do we have a patch or fix for this ? Thanks
2
3015
by: Steven Nagy | last post by:
Hi all, I have the following file: ~/cms/page.aspx Normally, if you hit a url like http://localhost/MyApp/cms/page.aspx?PageID=32 ... this would load content dynamically. No big deal, this is common right? So now I want to do some URL rewritting. I want to map:
1
5173
by: jbitz | last post by:
Hi, This has got me really baffled. This has got me really baffled. When I run Dim url As String = HttpContext.Current.Request.Url.AbsolutePath.ToLower from Application_beginRequest in Global.asax with server that ships with Visual Web Developer everything works as expected. However, today when I tried to move all code onto IIS server this just doesn't return the same URL! On localhost (Visual Web Developer), variable url is...
1
3483
by: Keef | last post by:
Hiya... just wondering if anyone else has come across this problem, and if there is a solution... i'm writing a reasonably simple IHttpModule to rewrite URLs ... in the BeginRequest event i do a app.Context.RewritePath("~/"+theFile,false) to the aspx file to display the content, then in the PreRequestHandlerExecute i do another RewritePath so that all the relative
0
9602
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
9439
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
10071
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...
0
9882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8905
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...
1
7431
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
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
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
3
2832
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.