Using HTTP Authentication with a C# WebRequest

前端 未结 3 2025
生来不讨喜
生来不讨喜 2020-12-11 00:17

I want to make a web request to a page that needs authenticating. How would I go about doing this? I found something that said possibly to use the Credentials property, but

3条回答
  •  借酒劲吻你
    2020-12-11 00:50

    Assign a new NetworkCredential instance to the Credentials property:

    webClient.Credentials = new NetworkCredential("Mehrdad", "Password");
    

提交回复
热议问题