locked
c# proxy authentication bluecoat failing RRS feed

  • Question

  • Hi,

     

    I have an application which connects to a third party hosted webservice.  I have had to code proxy authentication in for supporting clients that use this which works fine for all clients except those which seem to be on a bluecoat proxy.  Has anyone else had experience of this?  Any suggestions on why it may be different? I always get a 407 error on bluecoat. Code below is essentially what I am doing.  

    Thanks

    Stu

    switch (_proxySettings.ProxySetting)
    
            {
    
              case LocalReferences.ProxySetting.Auto:
    
                request.Credentials = CredentialCache.DefaultCredentials;
    
                _proxySettings.ProxySetting = LocalReferences.ProxySetting.Auto; 
    
                string windowsProxy = LocalReferences.Instance.GetWindowsProxy();
    
                if (windowsProxy != string.Empty)
    
                {
    
                  WebProxy p = new WebProxy();
    
                  p.Address = new Uri(windowsProxy);
    
                  p.Credentials = CredentialCache.DefaultCredentials;
    
                  request.Proxy = p;              
    
                }
    
                break;
    
              case LocalReferences.ProxySetting.Manual:            
    
                request.Proxy = BuildCustomProxy();
    
                _proxySettings.ProxySetting = LocalReferences.ProxySetting.Manual;
    
                request.
    
                break;
    
    ...........................................
    
          private IWebProxy BuildCustomProxy()
          {
            WebProxy proxy = new WebProxy();
    
            Proxy localProxy = LocalReferences.Instance.ProxyInfo;
    
            proxy.Address = new Uri(localProxy.URL);
    
            proxy.Credentials = new NetworkCredential(localProxy.UserName, localProxy.Password, localProxy.Domain);
    
            DealRoomSession.LogItem(String.Format("Request: Connecting through Proxy: {0}", proxy.Address), string.Empty, "SendComms()", 3);        
    
            return proxy;
          }
    ...............
              if (requestInfo.Action == CommsBase.Action.AddStructureToDealroom)
              {
                request.Timeout = 10800000;
              }
    
              localCert = new X509Certificate(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), LocalReferences.Instance.Certificate));
    
              request.ClientCertificates.Add(localCert);
              Stream requestStream = request.GetRequestStream();

    Friday, July 2, 2010 9:08 AM

All replies

  • Hi,

    This code should work fine with all proxies. I'm not exactly sure what could be causing issue but you could check... are you sure this is issue with bluecoat proxy perhaps you could check this on some other machine with bluecoat proxy to make sure this. Or there could be any other program on that pc causing this issue.

     

    Thanks,


    Mubi | http://mrmubi.com | Mark The Best Replies As Answers!
    Tuesday, August 10, 2010 7:56 PM