How can I prevent ServerXMLHTTP automatically after a redirect (HTTP 303 See Other Answers)?

I am using ServerXMLHTTP to perform an HTTP POST. The answer is returned - redirection (in particular, 303 See Section "Other"). ServerXMLHTTP automatically performs this forwarding, but this causes a loss of authentication because the authorization header of the original request is not distributed.

Is there a way to prevent automatic forwarding (or, conversely, ensure that the authorization header is sent)?

+4
source share
1 answer

ServerXMLHTTP does not support redirect hooks (see Microsoft Knowledge Base Article 308607 ). However, WinHTTP can be used in its place, and this contains a custom option to enable forwarding.

How to disable WinHTTP redirects in VBA:

webClient.Option(6) = False 

In the context:

 Set webClient = CreateObject("WinHttp.WinHttpRequest.5.1") webClient.Option(6) = False webClient.Open "POST", "http://example.com", False webClient.send ("") 
+6
source

Source: https://habr.com/ru/post/1277389/


All Articles