Sunday, July 11, 2010

How to request URL with login credential in C#

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.Credentials = new NetworkCredential(user, password);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();