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();