Newsgroups : Microsoft : microsoft.public.inetsdk.programming.wininet : 2006 Mar : converting a code piece to WinHTTPRequest 5.1

www.cryer.info
Managed Newsgroup Archive

converting a code piece to WinHTTPRequest 5.1

Subject:converting a code piece to WinHTTPRequest 5.1
Posted by:"Munish" (muni..@discussions.microsoft.com)
Date:Tue, 14 Mar 2006 12:51:26

Hi

I am working on a piece of code that had been written using the
MSXML.ServerXMLHTTP.4.0. I need to change this to use the
WinHTTP.WinHTTPRequest.5.1. This code is in VB

original code:
110  Set conn = CreateObject("WinHTTP.WinHTTPRequest.5.1")

270  conn.setProxy 2, m_sProxyServer, ""

     'set proxy credentials
280  conn.setProxyCredentials m_sProxyUser, m_sProxyPassword
290  conn.open "GET", sURL, False, m_sAuthName, m_sAuthPassword

300  conn.send objXMLSend

340  Set objXMLReceive = conn.responseXML

New Code:
110  Set conn = CreateObject("WinHTTP.WinHTTPRequest.5.1")

330      conn.setProxy 2, m_sProxyServer, ""
         'set proxy credentials

Const HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 1
Const HTTPREQUEST_SETCREDENTIALS_FOR_PROXY = 1

350     conn.open "GET", sURL, False

360     conn.SetCredentials m_sProxyUser, m_sProxyPassword,
HTTPREQUEST_SETCREDENTIALS_FOR_PROXY

380     conn.send objXMLSend


I need to pass on the login credentials for the website like how it was done
earlier using the m_sAuthNAme and m_sAuthPassowrd variables. The information
available in these variables is different than the proxy credentials.

Thanks

Replies:

www.cryer.info
Managed Newsgroup Archive