E
Electric Co.
Hello,
note: This is for a Faculty web site that is undergoing a migration to
an open source solution so my motives are legit.
I need to build a relay from IIS handling URL_A to a PHP server
(URL_B), get the content from the PHP server (if it exists) and then
serve it out via IIS. If the content does not exist then I need to
pass the request through to the IIS server and serve the pages from
there. All of this needs to be done while retaining the existing URL_A
on the client side as we do not want to lose/change the url.
The steps I am thinking to accomplish this wonderful hack are:
1.) Trap requests to URL from IIS in a HttpModule
2.) Send a request from the HttpModule to PHP server for page content
3.) If page content is returned from PHP server then serve it out from
IIS (first changing any URL_B links to URL_A so that end user does not
see the temporary url being used by the PHP server and the IIS server
will still trap requests)
4.) If page content is not returned from PHP then pass through request
on IIS server and let it handle it.
I have had limited success trying the following classes:
HttpWebRequest,
HttpWebResponse and
HttpContext.Current.Response.OutputStream.Write.
Unfortunately, after testing my code successfully on one part of the
new web site and I am now getting -1 returned at the end of the
following code:
HttpWebResponse myHttpWebResponse=
(HttpWebResponse)myRequest.GetResponse();
Stream streamResponse=myHttpWebResponse.GetResponseStream()
(int)myHttpWebResponse.ContentLength
Everything else in myHttpWebResponse looks to be fine and dandy.
It looks like I may have more success with:
WebClient.DownloadFile
What implications will I have with PostBacks and what if anything do I
need to do to forward/return headers?
Does anyone have experience with doing something like this and if so
could I get some pointers/heads up?
Is there a name to what I am trying to do that will help me find some
info on the internet?
Thanx in advance
Jim
note: This is for a Faculty web site that is undergoing a migration to
an open source solution so my motives are legit.
I need to build a relay from IIS handling URL_A to a PHP server
(URL_B), get the content from the PHP server (if it exists) and then
serve it out via IIS. If the content does not exist then I need to
pass the request through to the IIS server and serve the pages from
there. All of this needs to be done while retaining the existing URL_A
on the client side as we do not want to lose/change the url.
The steps I am thinking to accomplish this wonderful hack are:
1.) Trap requests to URL from IIS in a HttpModule
2.) Send a request from the HttpModule to PHP server for page content
3.) If page content is returned from PHP server then serve it out from
IIS (first changing any URL_B links to URL_A so that end user does not
see the temporary url being used by the PHP server and the IIS server
will still trap requests)
4.) If page content is not returned from PHP then pass through request
on IIS server and let it handle it.
I have had limited success trying the following classes:
HttpWebRequest,
HttpWebResponse and
HttpContext.Current.Response.OutputStream.Write.
Unfortunately, after testing my code successfully on one part of the
new web site and I am now getting -1 returned at the end of the
following code:
HttpWebResponse myHttpWebResponse=
(HttpWebResponse)myRequest.GetResponse();
Stream streamResponse=myHttpWebResponse.GetResponseStream()
(int)myHttpWebResponse.ContentLength
Everything else in myHttpWebResponse looks to be fine and dandy.
It looks like I may have more success with:
WebClient.DownloadFile
What implications will I have with PostBacks and what if anything do I
need to do to forward/return headers?
Does anyone have experience with doing something like this and if so
could I get some pointers/heads up?
Is there a name to what I am trying to do that will help me find some
info on the internet?
Thanx in advance
Jim