Given the following FORM definition contained in the default.asp html:
<form method="post" name="theform" action="validate.asp">
<input type="text" name="loginid">
<input type="password" name="pass">
<input type="submit" value="Login">
</form>
How can I log into this web page? The code below just takes me back to
the default.asp page. Is there anything I'm missing?
Dim strpost As String = "loginID=MyId&pass=MyPwd"
Dim objRequest As HttpWebRequest =
WebRequest.Create("http://MyServer/validate.asp")
objRequest.Method = "POST"
objRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.2; .NET CLR 1.0.3705;)"
objRequest.ContentLength = strpost.Length
objRequest.ContentType = "application/x-www-form-urlencoded"
Dim myWriter As New StreamWriter(objRequest.GetRequestStream)
myWriter.Write(strpost)
myWriter.Close()
Dim objResponse As HttpWebResponse = objRequest.GetResponse
Dim newsr As New StreamReader(objResponse.GetResponseStream)
Dim resTxt As String = newsr.ReadToEnd
newsr.Close()
MsgBox(resTxt)
*** Sent via Developersdex http://www.developersdex.com ***