×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

WinnHTTP and 404 Not Found

WinnHTTP and 404 Not Found

WinnHTTP and 404 Not Found

(OP)
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 = "http://www.microsoft.com/default.htm"

    ' 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.

RE: WinnHTTP and 404 Not Found


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','http://msdn.microsoft.com/vfoxpro/art/Foxpro_boxshot.jpg',.F.)

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close