automatically logging into a website

B

Brian Henry

Is there a way I could enter a username and password in a windows form then
take that and cause it to open a website up in IE and "post" the information
to a site so i can cause that site to log in useing this information?
 
B

Brian Henry

anyway to do it with an external browser though? would be a little bit
obtrusive to write a web browser host for the control so you had back
forward etc...

Mona said:
Hi Brain,

You can use the Web Browser control for the implementing the required
functionality.

Please refer to the following link for more details:

[How To Host a WebBrowser Control in Visual C# .NET to Post Form Data]
http://support.microsoft.com/?kbid=313068

HTH

Mona[Grapecity]


Brian Henry said:
Is there a way I could enter a username and password in a windows form
then take that and cause it to open a website up in IE and "post" the
information to a site so i can cause that site to log in useing this
information?
 
H

Herfried K. Wagner [MVP]

Brian Henry said:
Is there a way I could enter a username and password in a windows form
then take that and cause it to open a website up in IE and "post" the
information to a site so i can cause that site to log in useing this
information?

Below there is a sample on how to do that with a 'WebRequest' object. I
assume that this will work with a 'POST' request too:

\\\
Imports System.IO
Imports System.Net
..
..
..
Dim wrq As WebRequest = _
WebRequest.Create("https://example.org/shop/order.jsp")
wrq.Credentials = New NetworkCredential("username", "password")
Dim wrp As WebResponse = wrq.GetResponse()
Dim sr As New StreamReader(wrp.GetResponseStream())
MessageBox.Show(sr.ReadToEnd())
sr.Close()
wrp.Close()
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top