Click here to Skip to main content
15,908,175 members
Home / Discussions / C#
   

C#

 
GeneralRe: DragDrop event doesn't work Pin
Marc Clifton15-Jun-05 17:10
mvaMarc Clifton15-Jun-05 17:10 
GeneralSending the Excel Object Model for download Pin
dgap15-Jun-05 12:13
dgap15-Jun-05 12:13 
GeneralRTF to XML Pin
Member 202751015-Jun-05 11:55
Member 202751015-Jun-05 11:55 
GeneralRe: RTF to XML Pin
Christian Graus15-Jun-05 13:46
protectorChristian Graus15-Jun-05 13:46 
QuestionRe: RTF to XML Pin
Sandeepat.net14-Sep-10 23:57
Sandeepat.net14-Sep-10 23:57 
Generaldraw 2 transparent png one over the other Pin
Sasuko15-Jun-05 11:30
Sasuko15-Jun-05 11:30 
GeneralRe: draw 2 transparent png one over the other Pin
Christian Graus15-Jun-05 13:47
protectorChristian Graus15-Jun-05 13:47 
GeneralHttpWebRequest Troubles Pin
dhonda15-Jun-05 9:25
dhonda15-Jun-05 9:25 
I would like to write a console application in C# that allows for me to login to a website that requires a username and password. Additionally, I would like for the program to automatically store and manage my cookie(s) for the given website as well. The site that I have attempted to test this this on is listed below.
http://www.homeseekers.com/
user:test
pass:test
I have been following the examples I found on this site http://west-wind.com/presentations/dotnetWebRequest/dotnetWebRequest.htm with no luck. Could you tell me where exactly I am going astray? Or perhaps point me to some resource(s) that might clear up the confusion?

-TIA Dirk

ex.

try
{
string lcUrl = "http://www.homeseekers.com/Scripts/my_login.asp";
HttpWebRequest loHttp = (HttpWebRequest) WebRequest.Create(lcUrl);
loHttp.CookieContainer = new CookieContainer();
//pulled this information from firefox live http headers program
string lcPostData = "myUserID=test&myPassword=test&Login=Log+in&blnFromLogin=True&PreviousPage=%2Fdefault.asp%3F_ver%3D5%26_lid%3D0&remember=1";
loHttp.Method="POST";
byte [] lbPostBuffer = System.Text.Encoding.GetEncoding(1252).GetBytes(lcPostData);
loHttp.ContentLength = lbPostBuffer.Length;
Stream loPostData = loHttp.GetRequestStream();
loPostData.Write(lbPostBuffer,0,lbPostBuffer.Length);
loPostData.Close();
HttpWebResponse loWebResponse = (HttpWebResponse) loHttp.GetResponse();
Encoding enc = System.Text.Encoding.GetEncoding(1252);
StreamReader loResponseStream = new StreamReader(loWebResponse.GetResponseStream(),enc);
string lcHtml = loResponseStream.ReadToEnd();
for(int i = 0; i < loHttp.Headers.Count - 1; i++)
{
Console.WriteLine(loHttp.Headers[i]);
}
loWebResponse.Close();
loResponseStream.Close();

}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}

~Yes, I am some kind of idiot.~
QuestionBatch SqlCommand execution? Pin
Judah Gabriel Himango15-Jun-05 9:09
sponsorJudah Gabriel Himango15-Jun-05 9:09 
GeneralSockets and ArrayLists Pin
obelisk2915-Jun-05 8:33
obelisk2915-Jun-05 8:33 
GeneralRe: Sockets and ArrayLists Pin
eggie515-Jun-05 19:21
eggie515-Jun-05 19:21 
GeneralImaging Application - not enough RAM Pin
Libor Tinka15-Jun-05 8:03
Libor Tinka15-Jun-05 8:03 
GeneralRe: Imaging Application - not enough RAM Pin
DavidNohejl15-Jun-05 8:19
DavidNohejl15-Jun-05 8:19 
GeneralRe: Imaging Application - not enough RAM Pin
Judah Gabriel Himango15-Jun-05 8:30
sponsorJudah Gabriel Himango15-Jun-05 8:30 
GeneralRe: Imaging Application - not enough RAM Pin
Dave Kreskowiak15-Jun-05 8:51
mveDave Kreskowiak15-Jun-05 8:51 
GeneralRe: Imaging Application - not enough RAM Pin
DavidNohejl15-Jun-05 12:44
DavidNohejl15-Jun-05 12:44 
GeneralRe: Imaging Application - not enough RAM Pin
JDUK15-Jun-05 12:12
JDUK15-Jun-05 12:12 
GeneralRe: Imaging Application - not enough RAM Pin
Dave Kreskowiak15-Jun-05 18:52
mveDave Kreskowiak15-Jun-05 18:52 
GeneralRe: Imaging Application - not enough RAM Pin
Christian Graus15-Jun-05 13:48
protectorChristian Graus15-Jun-05 13:48 
GeneralRe: Imaging Application - not enough RAM Pin
Libor Tinka16-Jun-05 1:02
Libor Tinka16-Jun-05 1:02 
GeneralDetecting New Mail -- Exchange Server 2000 Pin
JMKerp295815-Jun-05 7:47
JMKerp295815-Jun-05 7:47 
GeneralNumber of pages in PrintPreviewControl Pin
Luis Alonso Ramos15-Jun-05 7:47
Luis Alonso Ramos15-Jun-05 7:47 
GeneralRe: Number of pages in PrintPreviewControl -- solved Pin
Luis Alonso Ramos15-Jun-05 8:50
Luis Alonso Ramos15-Jun-05 8:50 
GeneralOffice Interop - Populating Checkboxes Pin
tsmyrnio15-Jun-05 7:43
tsmyrnio15-Jun-05 7:43 
QuestionGDI+ drawing strings causes messed gaps between letters - how to fix? Pin
iliyang15-Jun-05 7:16
iliyang15-Jun-05 7:16 

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.