Posting To a URL using WebRequest

redbrad0

Member
Joined
May 31, 2007
Messages
14
Programming Experience
Beginner
I know there are a bunch of examples around the internet but for some reason I can not seem how to change my current code to allow me to post data. Can someone help me add posting to this code?

Everything works with reading the XML and everything else but I need to post a username & password

username=brad&password=MyPassword

VB.NET:
'# Lets request the URL to see what information is returned
strUrlToRequest = "http://www.domain.com/login.php"
Dim myRequest As System.Net.WebRequest = System.Net.WebRequest.Create(strUrlToRequest)
myRequest.Method = "POST"

Dim myResponse As System.Net.WebResponse = myRequest.GetResponse()
Dim xmlStream As System.IO.Stream = myResponse.GetResponseStream()
xmlDocument.Load(xmlStream)
 
Back
Top