I use in my project many times the HttpWebRequest
:
HttpWebRequest request = WebRequest.Create(requestedData) as HttpWebRequest;
Now, server's admin set a proxy for my connections. I'd like to add at any instance a code like this:
IWebProxy proxy = new WebProxy(Proxy, ProxyPort);
NetworkCredential nc = new NetworkCredential();
nc.UserName = ProxyLogin;
nc.Password = ProxyPassword;
request.Proxy = proxy;
request.Proxy.Credentials = nc;
without search for request
on my project and add this code (as function).
Is there a fast way?