Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WinnHTTP and 404 Not Found

Status
Not open for further replies.

jake0527

Programmer
Jan 25, 2005
1
US
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.
 
This is not the language I'm familiar with, but I use WINHttp with GET, but I noticed in your code sample, using the Microsoft site, you are using GET, but your are not getting anything. The URL you are using has nothing to return. Here is an example you could try (Translate to suit your platforom)
Code:
WinHttpReq.Open('GET','[URL unfurl="true"]http://msdn.microsoft.com/vfoxpro/art/Foxpro_boxshot.jpg',.F.)[/URL]


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top