HttpWebRequest not passing Credentials

后端 未结 4 2307
被撕碎了的回忆
被撕碎了的回忆 2020-11-27 15:53

I\'m trying to use HTTPWebRequest to access a REST service, and am having problems passing credentials in, see code below. I\'ve read that NetworkCredenti

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 16:37

    If your server uses NTLM authentication you may try this:

    CredentialCache cc = new CredentialCache();
    cc.Add(
        new Uri("https://mywebserver/webpage"), 
        "NTLM", 
        new NetworkCredential("user", "password"));
    request.Credentials = cc;
    

提交回复
热议问题