I need a simple ASP.NET proxy script for use proxying Ajax requests from JavaScript to remote servers.
The page should be written to be upwards compatible from early versions of ASP.NET, i.e, it should not require the latest version of .NET to function but should function with all versions of .NET.
The ASP.NET page should allow configuration of the remote server by inclusion of user modifiable variables at the top of the file, including hostname, port, protocol, path.
## Deliverables
Attached is a classic ASP version (JScript) of what I need. I need basically the exact same functionality in a .NET implementation.
<%@language=JScript%>
<%
var url="http://otherserver:9999/[login to view URL]"
var progIds = [
'MSXML2.ServerXMLHTTP.6.0',
'MSXML2.ServerXMLHTTP.5.0',
'MSXML2.ServerXMLHTTP.4.0',
'MSXML2.ServerXMLHTTP.3.0',
'[login to view URL]'
];
var objSrvHTTP = null;
for (var i = 0, l = [login to view URL]; i < l; i++) {
try {
objSrvHTTP = new ActiveXObject(progIds[i]);
//var objSrvHTTP=[login to view URL]("MSXML2.ServerXMLHTTP.4.0");
break;
} catch (e) {}
}
if (objSrvHTTP != null) {
if ([login to view URL]("REQUEST_METHOD")=="POST") {
var DataToSend = [login to view URL]([login to view URL]);
[login to view URL]("POST",url,false);
[login to view URL]("Content-type","application/x-www-form-urlencoded");
[login to view URL](DataToSend);
} else {
[login to view URL]("GET",url+"?"+[login to view URL]("QUERY_STRING"),false);
[login to view URL]();
}
[login to view URL]([login to view URL]);
} else {
[login to view URL]("Could not create Microsoft XML object. Please download and install, onto your webserver, the Microsoft XML components at [login to view URL] and retry your request.");
}?
%>