Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
GeneralRe: Problem with the ListView control Pin
Ankit Rajpoot6-Apr-09 17:28
Ankit Rajpoot6-Apr-09 17:28 
GeneralRe: Problem with the ListView control Pin
Luc Pattyn6-Apr-09 17:47
sitebuilderLuc Pattyn6-Apr-09 17:47 
GeneralRe: Problem with the ListView control Pin
Ankit Rajpoot7-Apr-09 2:44
Ankit Rajpoot7-Apr-09 2:44 
QuestionWebRequest.GetResponse() = error (407) Proxy Authentication Required Pin
abiemann6-Apr-09 13:36
abiemann6-Apr-09 13:36 
AnswerRe: WebRequest.GetResponse() = error (407) Proxy Authentication Required Pin
N a v a n e e t h6-Apr-09 15:51
N a v a n e e t h6-Apr-09 15:51 
GeneralRe: WebRequest.GetResponse() = error (407) Proxy Authentication Required Pin
abiemann9-Apr-09 8:50
abiemann9-Apr-09 8:50 
GeneralRe: WebRequest.GetResponse() = error (407) Proxy Authentication Required Pin
abiemann9-Apr-09 9:12
abiemann9-Apr-09 9:12 
GeneralRe: WebRequest.GetResponse() = error (407) Proxy Authentication Required PinPopular
abiemann10-Apr-09 13:58
abiemann10-Apr-09 13:58 
through trial-and-error I finally got it solved.
On my journey I've noticed that MANY people have problems with this, so no doubt this code will be copied plenty:


public string GetWebPage(string strURL)
{
    //stores the html returned by the server
    string strResult = "";

    //build the http request
    HttpWebRequest webRequest;
    webRequest = (HttpWebRequest)WebRequest.Create(strURL);

    IWebProxy proxy = WebRequest.GetSystemWebProxy();
    proxy.Credentials = CredentialCache.DefaultCredentials;

    webRequest.Proxy = proxy;
    webRequest.Method = "GET";
    webRequest.UserAgent = "Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322)";
    webRequest.Timeout = -1;

    //initiate contact with the server
    HttpWebResponse webResponse;
    webResponse = (HttpWebResponse)webRequest.GetResponse();

    //download the HTML
    using (StreamReader sr = new StreamReader(webResponse.GetResponseStream()))
    {
        //read the html
        strResult = sr.ReadToEnd();
        // Close and clean up the StreamReader
        sr.Close();
    }

    return strResult;
}

GeneralRe: WebRequest.GetResponse() = error (407) Proxy Authentication Required Pin
ishant78907-Jul-10 20:35
ishant78907-Jul-10 20:35 
GeneralRe: WebRequest.GetResponse() = error (407) Proxy Authentication Required Pin
eeidfn4-Oct-10 8:56
eeidfn4-Oct-10 8:56 
AnswerRe: WebRequest.GetResponse() = error (407) Proxy Authentication Required Pin
ebjean22-Jul-10 2:34
ebjean22-Jul-10 2:34 
QuestionOPC communication in c# Pin
AlessandroOPC6-Apr-09 11:29
AlessandroOPC6-Apr-09 11:29 
QuestionSystem.ArgumentException: The value of DatagridviewComboboxCell is invalid Pin
Priya Prk6-Apr-09 9:41
Priya Prk6-Apr-09 9:41 
QuestionNeed help with binding source Pin
faizych6-Apr-09 9:09
faizych6-Apr-09 9:09 
AnswerRe: Need help with binding source Pin
Henry Minute6-Apr-09 12:08
Henry Minute6-Apr-09 12:08 
GeneralRe: Need help with binding source Pin
faizych6-Apr-09 12:34
faizych6-Apr-09 12:34 
GeneralRe: Need help with binding source Pin
Henry Minute7-Apr-09 1:58
Henry Minute7-Apr-09 1:58 
Questionpassing XML data between .NET exes Pin
dyNamite6-Apr-09 8:21
dyNamite6-Apr-09 8:21 
AnswerRe: passing XML data between .NET exes Pin
Jimmanuel6-Apr-09 8:36
Jimmanuel6-Apr-09 8:36 
GeneralRe: passing XML data between .NET exes Pin
dyNamite7-Apr-09 7:12
dyNamite7-Apr-09 7:12 
GeneralRe: passing XML data between .NET exes Pin
Jimmanuel7-Apr-09 12:12
Jimmanuel7-Apr-09 12:12 
GeneralRe: passing XML data between .NET exes Pin
dyNamite8-Apr-09 18:17
dyNamite8-Apr-09 18:17 
QuestionThreading & StreamReader.Read() Question Pin
Harvey Saayman6-Apr-09 7:47
Harvey Saayman6-Apr-09 7:47 
AnswerRe: Threading & StreamReader.Read() Question Pin
S. Senthil Kumar6-Apr-09 8:09
S. Senthil Kumar6-Apr-09 8:09 
GeneralRe: Threading & StreamReader.Read() Question Pin
Harvey Saayman6-Apr-09 8:51
Harvey Saayman6-Apr-09 8:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.