HTML proxying in ASP.NET?

J

Jeff Dege

We have an app that is written in C#/ASP.NET 2.0, and hosted on IIS.

Or rather, it's mostly written in ASP.NET, but parts of it are client-
side javascript, pulling data from an Apache webserver in an ajax-like
fashion.

There is no chance of converting the Apache pages to run on IIS, or the
IIS pages to run on Apache, so we're inherently stuck with cross-domain
XMLHttpRequest() calls.

To this point, we've been running both IIS and Apache on different ports
on the same servers, and have had no problem. But we are concerned that
we will begin to see browsers that will reject calls to different ports.
And beyond that, we'd really like to try hosting Apache on a separate
box, better tuned for the sort of load that's being put on it.

That means we need a Web Proxy. And one that will run on IIS, and that
we can build, and maintain, with our current tool set (ASP.NET).

Problem is I've not been able to find one. There are plenty of simple
web proxies out there for Apache, and written in PHP, or CGI. But I've
not found an example of a simple web proxy for IIS written in ASP.NET.

I know people have had to have done this. But I've not been able to find
anything on the web. Is there some simple solution I've missed?

--
The government consists of a gang of men exactly like you and me. They
have, taking one with another, no special talent for the business of
government; they have only a talent for getting and holding office. Their
principal device to that end is to search out groups who pant and pine
for something they can't get and to promise to give it to them. Nine times
out of ten that promise is worth nothing. The tenth time is made good by
looting A to satisfy B. In other words, government is a broker in pillage,
and every election is sort of an advance auction sale of stolen goods.
- H. L. Mencken
 
M

Mike Placentra II

Have you considered communicating server-to-server with ASP.net web
services and (for example) PHP with NuSOAP? You might be able to skip
the JavaScript altogether.

-Mike Placentra II
 
J

jdege

Have you considered communicating server-to-server with ASP.net web
services and (for example) PHP with NuSOAP? You might be able to skip
the JavaScript altogether.

I'm sorry, but that seems non-responsive.

We have javascript on a browser that needs to access data on a
webserver other than the one that served the page that contains the
javascript. I don't see how any server-to-server solution could be
relevant.

The browser gets a page from:

http://server/webapp/page.aspx

The javascript on that page gets images from:

http://server:8080/imageapp.php?x=1&y=2

The problem is that some browsers consider http://server and http://server:8080
to be distinct domains - and over time more and more browsers will do
so.

What we need is a URL like:

http://server/proxy.aspx&uri=http://server:8080/imageapp.php?x=1&y=2

So the request goes to the same domain as the original page, but where
the proxy page we're requesting pulls the page from the URI that is
passed to it as an argument.

There are packages to create proxies like this on Apache readily
available on the net. But we need one that will run on IIS.
Preferably one written in C#/ASP.NET, so we can build it and maintain
it with our current toolset.

This seems like a very simple problem, and I know people have had to
address it - but I've not been able to find any examples.
 
J

Jeff Dege

Problem is I've not been able to find one. There are plenty of simple
web proxies out there for Apache, and written in PHP, or CGI. But I've
not found an example of a simple web proxy for IIS written in ASP.NET.

I know people have had to have done this. But I've not been able to
find anything on the web. Is there some simple solution I've missed?

I found a discussion of proxying in IIS at:

http://blogs.msdn.com/david.wang/archive/2005/08/01/
HOWTO_Common_URL_Red
irection_Techniques_for_IIS_Summary.aspx

It suggested a commercial package called ISAPI_Rewrite. I've tested it a
bit, and it seems to be working.
 

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

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top