Making a web request to a web page which requires windows authentication

前端 未结 4 1848
轮回少年
轮回少年 2020-11-30 08:24

I am trying to make a request to a web page using WebRequest class in .net. The url that I am trying to read requires Windows Authentication due to which I get an unauthoris

4条回答
  •  半阙折子戏
    2020-11-30 09:17

    For authenticating to WebService, use DefaultNetworkCredentials instead of DefaultCredentials:

    request.Credentials = CredentialCache.DefaultNetworkCredentials;
    

提交回复
热议问题