Click here to Skip to main content
15,900,906 members
Home / Discussions / C#
   

C#

 
AnswerRe: Reading DBF file....???- - - - Please help Me- - - Pin
vivasaayi11-Sep-09 1:10
vivasaayi11-Sep-09 1:10 
AnswerRe: Reading DBF file....???- - - - Please help Me- - - Pin
April Fans22-Sep-09 17:39
April Fans22-Sep-09 17:39 
QuestionPost data from windows application to a web page Pin
vnr8-Sep-09 20:53
vnr8-Sep-09 20:53 
AnswerRe: Post data from windows application to a web page Pin
Abhijit Jana8-Sep-09 21:00
professionalAbhijit Jana8-Sep-09 21:00 
GeneralRe: Post data from windows application to a web page Pin
vnr8-Sep-09 21:11
vnr8-Sep-09 21:11 
AnswerRe: Post data from windows application to a web page Pin
Christian Graus8-Sep-09 21:06
protectorChristian Graus8-Sep-09 21:06 
AnswerRe: Post data from windows application to a web page Pin
vnr8-Sep-09 21:42
vnr8-Sep-09 21:42 
QuestionC#/.NET WinForms Application to login to a forum using HttpWebRequest and POST [modified] Pin
dedlok8-Sep-09 20:25
dedlok8-Sep-09 20:25 
Hi,

I am working on building a C# Winforms application which will allow me to login to a forum or site and perform certain tasks. I am stuck at the very 1st step. I cannot login to the forum. Here is what I have tried so far,
the Login button has the following code :-

try
			{
				Uri uri = new Uri("http://www.thinkdigit.com/forum/login.php");
				string data = "vb_login_username="+userid"&vb_login_password="+password;
				HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
				request.Method = WebRequestMethods.Http.Post;
				request.ContentLength = data.Length;
				request.ContentType = "application/x-www-form-urlencoded";
				StreamWriter writer = new StreamWriter(request.GetRequestStream());
				writer.Write(data);
				writer.Close();
				HttpWebResponse response = (HttpWebResponse)request.GetResponse();
				StreamReader reader = new StreamReader(response.GetResponseStream());
				string tmp = reader.ReadToEnd();
				response.Close();
				richTextBox1.AppendText(tmp);			   
			}
			catch (Exception ex)
			{
				textBox3.Text = ex.ToString();
			}


Thats what I scrounged up after google busting and visiting so many forum posts. Unfortunately this does not seem to log me in the forum. I am checking the HTML generated content in t my richtextbox control and there's the login fields there still. Which means it didn't login.

I checked the login page.

and these are the contents there

<form name="loginfrm" id="loginfrm" action="login.php?do=login" method="post" onsubmit="md5hash_2(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0);">

<input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="User Name" onblur="myUnTip();" onmouseout="myUnTip();" onfocus="if (this.value == 'User Name') this.value = '';myTip();"   />

<input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" id="navbar_password" size="10" tabindex="102" />

<input type="submit" class="button" value="Log in" tabindex="104" title="Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself." accesskey="s" />


those are the relevant parts IMHO

so I am filling up the username field, filling up the password, posting to the login.php page with the data ...what am i mising out ?

Also I have another query. Is there a way to load the response , as in HttpGetResponse in a webbroswer control ? If I am login in to the forum, then it would be nice to have the logged in page loaded in my webbrowser control!!

Any Help Would be appreciated.

thanks a bunch folks for your time!!



modified on Wednesday, September 9, 2009 3:57 AM

AnswerRe: C#/.NET WinForms Application to login to a forum using HttpWebRequest and POST Pin
dedlok11-Sep-09 14:57
dedlok11-Sep-09 14:57 
QuestionUrgent Help Pin
saurabh98-Sep-09 20:04
saurabh98-Sep-09 20:04 
AnswerRe: Urgent Help Pin
Christian Graus8-Sep-09 20:15
protectorChristian Graus8-Sep-09 20:15 
AnswerRe: Urgent Help Pin
V.8-Sep-09 22:05
professionalV.8-Sep-09 22:05 
Questionwhich is the faster and efficent approach??? Pin
faheemnadeem8-Sep-09 19:54
faheemnadeem8-Sep-09 19:54 
AnswerRe: which is the faster and efficent approach??? Pin
Christian Graus8-Sep-09 20:01
protectorChristian Graus8-Sep-09 20:01 
GeneralRe: which is the faster and efficent approach??? Pin
faheemnadeem8-Sep-09 20:21
faheemnadeem8-Sep-09 20:21 
GeneralRe: which is the faster and efficent approach??? Pin
Christian Graus8-Sep-09 20:37
protectorChristian Graus8-Sep-09 20:37 
AnswerRe: which is the faster and efficent approach??? Pin
Expert Coming8-Sep-09 21:31
Expert Coming8-Sep-09 21:31 
QuestionWindows services in c# Help!!! Pin
faheemnadeem8-Sep-09 18:36
faheemnadeem8-Sep-09 18:36 
AnswerRe: Windows services in c# Help!!! Pin
Jacobb Michael8-Sep-09 18:47
Jacobb Michael8-Sep-09 18:47 
GeneralRe: Windows services in c# Help!!! Pin
faheemnadeem8-Sep-09 18:56
faheemnadeem8-Sep-09 18:56 
GeneralRe: Windows services in c# Help!!! Pin
Christian Graus8-Sep-09 19:08
protectorChristian Graus8-Sep-09 19:08 
GeneralRe: Windows services in c# Help!!! Pin
faheemnadeem8-Sep-09 19:13
faheemnadeem8-Sep-09 19:13 
GeneralRe: Windows services in c# Help!!! Pin
Christian Graus8-Sep-09 19:15
protectorChristian Graus8-Sep-09 19:15 
GeneralRe: Windows services in c# Help!!! Pin
faheemnadeem8-Sep-09 19:20
faheemnadeem8-Sep-09 19:20 
QuestionFileDownload Event does not happend....! Pin
Jacobb Michael8-Sep-09 18:01
Jacobb Michael8-Sep-09 18: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.