Click here to Skip to main content
15,901,426 members
Home / Discussions / C#
   

C#

 
GeneralMDB to Text Pin
Jassim Rahma21-Dec-02 9:46
Jassim Rahma21-Dec-02 9:46 
GeneralRe: MDB to Text Pin
David Stone21-Dec-02 10:19
sitebuilderDavid Stone21-Dec-02 10:19 
GeneralRe: MDB to Text Pin
jassim21-Dec-02 10:26
jassim21-Dec-02 10:26 
Generalupdate stausBar Pin
Jassim Rahma21-Dec-02 9:44
Jassim Rahma21-Dec-02 9:44 
GeneralExtended MAPI and C# Pin
Anonymous21-Dec-02 6:07
Anonymous21-Dec-02 6:07 
GeneralControl Properties Pin
Dave Kerr21-Dec-02 0:52
Dave Kerr21-Dec-02 0:52 
GeneralRe: Control Properties Pin
Burt Harris21-Dec-02 11:28
Burt Harris21-Dec-02 11:28 
GeneralHTTP Read w/ Authentication Pin
Larry Rutledge20-Dec-02 11:27
Larry Rutledge20-Dec-02 11:27 
I used the following code to download the source of an HTML page:

<br />
  ...<br />
  try<br />
  {<br />
    // _url is a private variable which contains the URL to download<br />
    HttpWebRequest _request = (HttpWebRequest)WebRequest.Create(_url);<br />
<br />
    if (_useProxy)<br />
    {<br />
      WebProxy _proxy = new WebProxy(_proxyHost + ":" + _proxyPort.ToString());<br />
      _request.Proxy = _proxy;<br />
    }<br />
<br />
    HttpWebResponse _response = (HttpWebResponse)_request.GetResponse();<br />
<br />
    if (_response.StatusCode == HttpStatusCode.OK)<br />
    {<br />
      Stream _stream = _response.GetResponseStream();<br />
      StreamReader _streamReader = new StreamReader(_stream, Encoding.UTF8);<br />
      MessageBox.Show(_streamReader.ReadToEnd().Trim());<br />
    }<br />
  catch (WebException we)<br />
  {<br />
    // HTTP response was not "OK", handle HTTP error<br />
  }<br />
  catch (Exception e)<br />
  {<br />
    // Handle exception<br />
  }<br />
  ...<br />


My question is, what if the page I need to access requires authentication. In other words, when browsing normally, with a web browser client, a dialog pops up asking for my username and password. I have the access information, but I want the preceding code to be able to send that authentication information along and get the code without any user intervention.

Any ideas?
GeneralRe: HTTP Read w/ Authentication Pin
leppie20-Dec-02 17:15
leppie20-Dec-02 17:15 
GeneralRe: HTTP Read w/ Authentication Pin
Burt Harris21-Dec-02 9:53
Burt Harris21-Dec-02 9:53 
GeneralDirectX 9.0 Released Pin
Heath Stewart20-Dec-02 9:26
protectorHeath Stewart20-Dec-02 9:26 
QuestionDoes this type of Windows Tree Control exist??? Pin
LongRange.Shooter20-Dec-02 9:08
LongRange.Shooter20-Dec-02 9:08 
AnswerRe: Does this type of Windows Tree Control exist??? Pin
Kannan Kalyanaraman20-Dec-02 18:29
Kannan Kalyanaraman20-Dec-02 18:29 
GeneralRe: Does this type of Windows Tree Control exist??? Pin
LongRange.Shooter23-Dec-02 2:43
LongRange.Shooter23-Dec-02 2:43 
GeneralInsert a macro Pin
mvmeijer20-Dec-02 3:35
mvmeijer20-Dec-02 3:35 
GeneralLogical Drive Information Pin
matthias s.19-Dec-02 15:23
matthias s.19-Dec-02 15:23 
GeneralRe: Logical Drive Information Pin
Kannan Kalyanaraman19-Dec-02 18:02
Kannan Kalyanaraman19-Dec-02 18:02 
GeneralRe: Logical Drive Information Pin
Jeff J19-Dec-02 20:24
Jeff J19-Dec-02 20:24 
GeneralRe: Logical Drive Information Pin
Rein Hillmann19-Dec-02 21:31
Rein Hillmann19-Dec-02 21:31 
GeneralRe: Logical Drive Information Pin
leppie20-Dec-02 6:11
leppie20-Dec-02 6:11 
GeneralSecondary Thread Pin
kasturirawat19-Dec-02 14:25
kasturirawat19-Dec-02 14:25 
GeneralRe: Secondary Thread Pin
Eric Gunnerson (msft)20-Dec-02 8:19
Eric Gunnerson (msft)20-Dec-02 8:19 
Questionsecurity for a service? Pin
imran_rafique19-Dec-02 13:07
imran_rafique19-Dec-02 13:07 
GeneralCursor woes. Pin
Tom Welch19-Dec-02 4:06
Tom Welch19-Dec-02 4:06 
GeneralRe: Cursor woes. Pin
Rob Graham19-Dec-02 5:01
Rob Graham19-Dec-02 5:01 

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.