winhttp

Do I really need to register WinHttp on Windows Server 2008 before using WinHttpRequest.5.1?

Basically I think this is a bug in Windows Server 2008, but I am not a COM ninja so it seems equally likely that I'm just doing something dumb. The question is: bug or programmer error? We use WinHttpRequest (the ActiveX component of WinHttp) to read http:// and https://. The ProgID we are using to look up the component is WinHttp.WinHt...

compile errors w/wininet & winhttp in MFC application

Strangely I had this working before but I reinstalled my system, upgraded to w7 and now I can't seem to get this code to compile. The problem is that I'm using winhttp.h in most of my application, but I have a simple FTP client object that I wrote using wininet.h functionality. I can't seem to get the application to compile now, no matt...

Creating robust HTTP connection for dummy users with WinINET

I'm making a program which downloads a simple file from internet on Windows, using Wininet family API because I want to utilize its IE-compatible proxy behavior. As you all know, current IE has several proxy settings: auto-detect (WPAD), auto-configure (PAC), manually single URL, proxy servers per protocol, socks, direct, ... For most us...

WinHTTP and Windows 7 x64: Error

I have an application which uses WinHTTP, and it seems under Windows 7 (64-bit; have yet to test the 32-bit version) the call to WinHttpOpen fails, returning "The group or resource is not in the correct state to perform the requested operation." This corresponds to error code 5023, and occurs for the Administrator as well as a st...

Upload TXT or CSV file Using WinHTTP and LotusScript

'Declare long Dim lng_resolveTimeout, lng_connectTimeout, lng_sendTimeout, lng_receiveTimeout As Long 'Declare integer Dim int_serverCredentials As Integer 'Declare variants Dim var_submitObject As Variant 'Set values int_serverCredentials = 0 lng_resolveTimeout = 120000 'miliseconds = 2 minutes lng_connectTimeout = 1200000 lng_sendT...

Excel VBA WinHttp How to submit a form

I'm using WinHttp to access an URL, say "http://server/application?id=abc" When I try to URL from Explorer, I get an HTML table with lots of info. However when I try from Excel VBA like this: ht.Open "POST", "http://server/application?id=abc", False ht.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" ...

How to get WinInet's proxy settings quickly (without network dependency)

How can I quickly retrieve Internet Explorer's proxy settings from C++? The windows function WinHTTPGetIEProxyConfigForCurrentUser() gives me exactly what I want... The problem with WinHTTPGetIEProxyConfigForCurrentUser() is it is running unacceptably slowly on some of my user's systems (they are running Windows 7). For these users, th...

Covert String to LPVOID and LPCWSTR in C++

Hi, I’m working with the winHTTP API in c++ and I have started to write a wrapper class for my application. For simplicity I have a number of functions that can take string parameters and use them in the winHTTP calls. However many of these require the data to be LPVOID or LPCWSTR. I can make it all work by making my wrapper functions ...

AutoProxy issue in Win 7 using NTLM authentication

We work in a network that uses a proxy server that accepts NTLM based and basic authentication. When I try to connect to an external IP from an app that I am creating, while running it on a Windows 7 machine, I get the following WinHttp error code 12152 (It sometimes happens from WinHttpRecieveResponse and sometimes from WinHttpSendRequ...

Getting redirect information with C# and C++

Hi all. What am I doing wrong? I'm trying to get redirect information from a server that I use for authenticating a user. This works good with my C# code but I cannot make my C++ code working. So here's the working C# code: string postData = @"username=myUsername&serviceID=someServiceId&password=somePassword"; byte[] postBytes = Encodin...

Send User-Agent through CONNECT and POST with WinHTTP?

I'm trying to POST to a secure site using WinHttp, and running into a problem where the User-Agent header isn't being sent along with the CONNECT. I am using a lightly-modified code sample from MSDN: HINTERNET hHttpSession = NULL; HINTERNET hConnect = NULL; HINTERNET hRequest = NULL; WINHTTP_AUTOPROXY_OPTIONS AutoPr...

Call server with WinInet and WinHTTP

Hi all, I have a request that works fine when I use the WinInet API. I now want to make that request with the WinHTTP API as I already use it in my project and as it is simply better. My request is used for calling JSON. I already authenticated before calling this. When authenticating I get a SessionID that I send via cookie. So here is ...

Win32: What is the status of chunked encoding support in WinHttpReadData?

The documentation for WinHttpReadData says, regarding HTTP's chunked transfer coding: Starting in Windows Vista and Windows Server 2008, WinHttp enables applications to perform chunked transfer encoding on data sent to the server. When the Transfer-Encoding header is present on the WinHttp response, WinHttpReadData strips the chunki...

winHTTP GET request C++

I'll get right to the point. This is what a browser request looks like GET /index.html HTTP/1.1 This is what winHTTP does GET http://site.com/index.html HTTP/1.1 Is there any I can get the winHTTP request to be the same format as the regular one? I'm using VC++ 2008 if it makes any difference ...

HttpAddUrl permissions

I'm trying to run a custom WinHTTP based web-server on Windows Server 2008 machine. I pass "http://*:22222/" to HttpAddUrl When I start my executable as Administrator or LocalSystem everything works fine. However if I try to run it as NetworkService to minimize security risks (since there are no legitimate reasons for the app to use ad...

How to give ASP.NET access to a private key in a certificate in the certificate store?

I have an ASP.NET application that accesses private key in a certificate in the certificates store. On Windows Server 2003 I was able to use winhttpcertcfg.exe to give private key access to the NETWORK SERVICE account. How do I give permissions to access a Private Key in a certificate in the certificate store (Local Computer\Personal) on...

Upload file via HTTP from VBA (WinHTTP)

Hi all, I'm trying to (HTTP) upload a binary file programmatically from within VBA. I intend to put an ASPX page on the server to accept the file and certain additional parameters. I know there are lots of nice ways to do that (e.g. use web service instead of aspx), but my constraint is that it must run in VBA (in an excel file), and t...

Are there any complete examples of using winhttp in C on windows?

I can find tons of examples in C++, but nothing that's written in just C. I am trying to connect to an http server, download the returned data, and then save it to a file. Is there a better way to do it on Windows? Should I not be using WinHttp or WinInet? Windows documentation for C seems to be extremely lacking on the internet. Thank y...

Set IP preference in WinHTTP (c++)

Hi, I have a code that using WinHTTP over Win7, but the connction to specific hostname take a long time as he try to use the IPv6 address (that is disable). I want to config the connection (maybe WinHttpConnect parametrs) to try IPv4 FIRST. Please help! ...

Windows C++ Should I use WinHttp library or XmlHttp from MSXML?

A rather simple question. Should I use the WinHttp library to make a web service request in my C++ programs or should I use the IXmlHttpRequest interface in the msxml library to send web service requests? Obviously the WinHttp library provides a lot more fine control compared to the IXmlHttpRequest library. But the XmlHttpRequest object ...