0

I am trying to send request over websocket through proxy in C# but I am getting server unavailable error. However it works without proxy. I have the following code:-

strCompleteURL = "ws://xxxxxxxxxxxxxxxx";
                   
                    string UserName = "xxxxx"
                    string Password = "yyyyy"

                    CancellationTokenSource source = new CancellationTokenSource();
                    using (var ws = new ClientWebSocket())
                    {
                        
                       
                        ws.Options.Proxy = new WebProxy("x.x.x.x:y");
                        ws.Options.Proxy.Credentials = new NetworkCredential(UserName, Password);
                        
                        ws.ConnectAsync(new Uri(strCompleteURL), CancellationToken.None).Wait();

                     }

I am using ClientWebSocket class of dot net framework to perform this action. But it is not working. Can anybody provide the solution of this problem ?

Puneet Pant
  • 918
  • 12
  • 37

0 Answers0