tags:

views:

793

answers:

3

When I make an HTTP request with the method HttpSendRequest of the WinINet API, and the response sends "302: Moved Temporarily", the WinINet API automatically follows the redirection instruction and makes a new request.

So, How to prevent HttpSendRequest to follow redirects (30x Status Codes)?

I don't want't to make two requests... I wan't to get the the first response it got with the status code 302 in it's header.

+1  A: 

I found a flag INTERNET_FLAG_NO_AUTO_REDIRECT that I must pass to HttpOpenRequest.

But, it isn't working....

Daniel Silveira
A: 

Redirection can be prevented if you are able to use WinHTTP instead (link).

Matthew Murdoch
A: 

Try using INTERNET_FLAG_NO_AUTO_REDIRECT in the call to HttpSendRequest. Sounds like you're trying to use it from HttpOpenRequest.

I use this flag with InternetOpenUrl, and it works properly in that call.

Adrian McCarthy