Digest Authentication验证如何通过 RRS feed

  • 问题

  • 目前有一台设备,这个设备自带了一个web的管理页,我需要在winform中通过这个web页接口来获取一些参数以及上传文件,但是这个web页的认证方式是Digest Authentication,试了很多方法均无法通过此认证,返回为:HTTP/1.1 401 Unauthorized

    WWW-Authenticate: Digest realm="GDCBT400W", domain="",qop="auth", nonce="1f9028348873658d64f7cdd03ff63110", opaque="5ccc069c403ebaf9f0171e9517f40e41",algorithm="MD5", stale="FALSE"

    请问有通过这种认证的C# Demo代码吗。

    2015年9月16日 1:50


  • Hi,

    Please refer to the code:

    WebRequest myWebRequest = HttpWebRequest.Create(myUri);
        HttpWebRequest myHttpWebRequest = (HttpWebRequest)myWebRequest;
        NetworkCredential myNetworkCredential = new NetworkCredential(username, password);
        CredentialCache myCredentialCache = new CredentialCache();
        myCredentialCache.Add(myUri, "Digest", myNetworkCredential);

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2015年9月17日 7:44