authentification sur site web https
Bonjour,
Je cherche une méthode pour m'authentifier sur un site web avec une authentification NTLM (boite de dialogue).
Celle-ci fonctionne mais ne conserve pas le jeton par le site tant que mon programme fonctionne.
Je veux reproduire l'équivalent de ce que excel fait lorsque l'on clique manuellement dans la boite de dialogue "connection à ..."
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Sub cred()
Const HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0
Const HTTPREQUEST_SETCREDENTIALS_FOR_PROXY = 1
Const HTTPREQUEST_PROXYSETTING_DEFAULT = 0
Const HTTPREQUEST_PROXYSETTING_PRECONFIG = 0
Const HTTPREQUEST_PROXYSETTING_DIRECT = 1
Const HTTPREQUEST_PROXYSETTING_PROXY = 2
Dim myReq As WinHttpRequest
Set myReq = New WinHttpRequest
myReq.Open "GET", "https://monsite/Allitemsg.aspx", False
myReq.send
MsgBox myReq.Status
'Set credentials
myReq.SetCredentials "USERNAME", "PASSWORD", HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
'Set credentials for the proxy.
myReq.setProxy (HTTPREQUEST_PROXYSETTING_PRECONFIG)
myReq.SetAutoLogonPolicy (AutoLogonPolicy_Always)
myReq.Option(WinHttpRequestOption_EnableRedirects) = True
myReq.send
Dim res As String
res = myReq.responseText
MsgBox res
End Sub |