I have an Access application (don't ask) which uses a .Net component to connect to our web service. Some of the people trying to use the program are on corporate networks and have proxies that require authroisation. I have modified the component to specify the address and port number of the proxy and have tried to get it to pass through the Windows credentials, see code:
WebProxy prox = new System.Net.WebProxy(_proxy);
prox.Credentials = CredentialCache.DefaultCredentials;
service.Proxy = proxy;
It connects to the proxy ok but is still showing as an annonymous connection. Any idea how I get it to pass through the credentials of the current logged on user?
Many thanks
Bechir BejaouiPosted Dec 1, 2008, 7:56 AM
Then you have to implement the IWebProxy
public class MyProxy : System.Net.IWebProxy
{
public string User { get; set; }
public string Password { get; set; }
private System.Net.ICredentials _NetWorkCredential;
public MyProxy(string User, string Password)
{
this.User = User;
this.Password = Password;
_NetWorkCredential = new System.Net.NetworkCredential(User, Password);
}
public System.Net.ICredentials Credentials
{
get { return _NetWorkCredential; }
set { _NetWorkCredential = value; }
}
public Uri GetProxy(Uri oUri)
{
return new Uri(oUri.ToString());
}
public bool IsBypassed(Uri oUri)
{
return false;
}
}
And then move to the config file and parameter it