login to a website from textboxes C#
Hello,
What I need to develop is an application that contains 2 textboxes, 1 button, 1 label.
In the first text box, I will put my user name.
In the second my password.
When I click the button, The software should visit this page: https://eole.telecom-paristech.fr/
and post my username and my password (that I have already entered in the textboxes)
The label should then display the HTML code of the page returned after the successful login.
How can I do this?
I am getting too much trouble to find a good help on how should I use the POST method in HTTPrequest.
Can anyone write a small code for me?
THANKS
Anwarul HaquePosted Dec 11, 2009, 7:16 AM
First thing your full requirment is not clreared.
As per my undestanding, you want to display a message after succesfully login or failure user id & password.
In this scenario I would like to prefer to use button click event.
check user on button click event, is this user is valid or not.
if valid then move on new page or fail you keep on same page. below is dummy example
protected void btnSubmit_Click(object sender, EventArgs e)
{
bool ValidUser = false;
//User checking block
ValidUser = checkUser(User, password);
if (ValidUser)
{
Response.Redirect("https://eole.telecom-paristech.fr");
}
else
{
lblMessage.Text = "Incorrect user id/password. Please try again.";
}
}
OR
Specify few more details.
Hope this help