I have a couple of issues using WinHTTP.
Basically, I just trying to use WinHTTP to pass a set of custom Headers to another website. Really, that's not the problem:
When I open a connection to a known website, I always get a 404 not found returned. Even when I open another browser and put the exact URL in and it works perfectly.
I'm using vbScript in an ASP. The page is very simple and has no redirects or anything. I only want to very I can connect and return the Reponse I expect before I go on.
Can anyone help?
Here's the snipit of code:
----------
<%
Dim LVsServer
Dim LVsHttpReq
Dim LVsResponseText
Const WinHttpRequestOption_UserAgentString = 0
Const WinHttpRequestOption_URL = 1
Const WinHttpRequestOption_URLCodePage = 2
Const WinHttpRequestOption_EscapePercentInURL = 3
Const WinHttpRequestOption_SslErrorIgnoreFlags = 4
Const WinHttpRequestOption_SelectCertificate = 5
Const WinHttpRequestOption_EnableRedirects = 6
Const WinHttpRequestOption_UrlEscapeDisable = 7
Const WinHttpRequestOption_UrlEscapeDisableQuery = 8
Const WinHttpRequestOption_SecureProtocols = 9
Const WinHttpRequestOption_EnableTracing = 10
LVsServer = "
' Create the WinHTTPRequest ActiveX Object.
Set LVsHttpReq = Server.CreateObject("WinHttp.WinHttpRequest.5")
' Open an HTTP connection.
LVsHttpReq.Open "GET", LVsServer, false
' Send the HTTP Request.
LVsHttpReq.Send
LVsResponseText = LVsHttpReq.ResponseText
Set LVsHttpReq = nothing
%>
<hl>Here's the Page: </hl>
<table border="1" bgcolor="#FFFFFF">
<tr><td>
<%=LVsResponseText%>
</td></tr>
</table>
<hl>Here's the Code: </hl>
<table border="1" bgcolor="#FFFFFF">
<tr><td>
<pre>
<%= Server.HTMLEncode(LVsResponseText) %>
</pre>
</td></tr>
</table>
-----
Any help would be greatly appreciated.
Basically, I just trying to use WinHTTP to pass a set of custom Headers to another website. Really, that's not the problem:
When I open a connection to a known website, I always get a 404 not found returned. Even when I open another browser and put the exact URL in and it works perfectly.
I'm using vbScript in an ASP. The page is very simple and has no redirects or anything. I only want to very I can connect and return the Reponse I expect before I go on.
Can anyone help?
Here's the snipit of code:
----------
<%
Dim LVsServer
Dim LVsHttpReq
Dim LVsResponseText
Const WinHttpRequestOption_UserAgentString = 0
Const WinHttpRequestOption_URL = 1
Const WinHttpRequestOption_URLCodePage = 2
Const WinHttpRequestOption_EscapePercentInURL = 3
Const WinHttpRequestOption_SslErrorIgnoreFlags = 4
Const WinHttpRequestOption_SelectCertificate = 5
Const WinHttpRequestOption_EnableRedirects = 6
Const WinHttpRequestOption_UrlEscapeDisable = 7
Const WinHttpRequestOption_UrlEscapeDisableQuery = 8
Const WinHttpRequestOption_SecureProtocols = 9
Const WinHttpRequestOption_EnableTracing = 10
LVsServer = "
' Create the WinHTTPRequest ActiveX Object.
Set LVsHttpReq = Server.CreateObject("WinHttp.WinHttpRequest.5")
' Open an HTTP connection.
LVsHttpReq.Open "GET", LVsServer, false
' Send the HTTP Request.
LVsHttpReq.Send
LVsResponseText = LVsHttpReq.ResponseText
Set LVsHttpReq = nothing
%>
<hl>Here's the Page: </hl>
<table border="1" bgcolor="#FFFFFF">
<tr><td>
<%=LVsResponseText%>
</td></tr>
</table>
<hl>Here's the Code: </hl>
<table border="1" bgcolor="#FFFFFF">
<tr><td>
<pre>
<%= Server.HTMLEncode(LVsResponseText) %>
</pre>
</td></tr>
</table>
-----
Any help would be greatly appreciated.