1  class VidyoPortalUserServiceWithAuthentication : VidyoPortalUserService
 2     {
 3         String _username;
 4         String _password;
 5         public VidyoPortalUserServiceWithAuthentication(String username, String password)
 6         {
 7             _username = username;
 8             _password = password;
 9         }
10         protected override WebRequest GetWebRequest(Uri uri)
11         {
12             WebRequest wr = base.GetWebRequest(uri);
13             wr.Headers.Add("Authorization", "Basic " +
14                 Convert.ToBase64String(Encoding.ASCII.GetBytes(_username + ":" + _password)));
15             return wr;
16         }
17     }
18 
19 VidyoPortalUserServiceWithAuthentication vpus = new VidyoPortalUserServiceWithAuthentication(this.tbxID.Text, this.tbxPwd.Text);
20 
21 
22                 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(RequestString);
23 
24                 request.AllowAutoRedirect = false;
25                 request.Method = "GET";
26                 // Get Found (302) response.
27                 HttpWebResponse response = (HttpWebResponse)request.GetResponse();

 

相关文章:

  • 2022-01-10
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-11-19
  • 2021-11-27
猜你喜欢
  • 2021-12-12
  • 2021-07-14
  • 2021-05-16
  • 2021-07-07
  • 2021-12-17
  • 2022-12-23
相关资源
相似解决方案