I'm trying to login to a banking site
(https://www.providentconnection.com) using vb.net. I've tried many
variations of WebClient and HttpWebRequest; none of which I've got to
work. My latest version is:
Dim myWebClient As New WebClient
Dim nvc As New NameValueCollection
nvc.Add("Login", username)
nvc.Add("Password", password)
nvc.Add("ValidationReq", "1")
nvc.Add("WhichBrowser", "IE")
nvc.Add("pgBrowserVersion", "4")
url = "https://www.providentconnection.com/Login.asp?Login=plugh&Password=xyzzy&ValidationReq =1&WhichBrowser=IE&pgBrowserVersion=4"
myWebClient.Headers.Add("Content-Type",
"application/x-www-form-urlencoded")
' Upload the NameValueCollection.
Dim byts() As Byte = New Byte() {}
Dim responseArray As Byte() = myWebClient.UploadData(url, "POST",
byts)
Dim sw As New StreamWriter("trace.html")
Dim rspTxt = "Response received was :" +
Encoding.ASCII.GetString(responseArray)
I've tried the name value pairs, and the url (?) encoded formats w &
w/o HttpWebRequest and WebClient.
The content of the login page is:
<link href=styles.css rel="stylesheet">
<html>
<head>
<meta NAME="GENERATOR" Content="DreamWeaver">
<title>Login to Provident's Commercial Internet Banking</title>
<link href="stylesnav.css" rel=stylesheet>
<body background="images/top/topbkgd.gif" class=body2 topmargin=0
leftmargin=0>
<table cellpadding=0 cellspacing=0 border=0 height=80 width=100%>
<tr>
<td width=160><img src="images/top/logo.gif" height=100
width=180></td>
<td width=100%><img src="images/top/title.gif" height=100></td>
</tr>
</table>
<center>
<form name=RequestForm onSubmit="return CheckBlank()" method="POST"
action="login.asp" >
<table width=400 cellspacing=0 cellpadding=0>
<tr><td colspan=2 class=information>Please enter your User Name and
Password below:</td></tr>
<tr>
<td class=informationb>User Name:</td>
<td><input class=input type=text name="Login" size="10"></td>
</tr>
<tr>
<td class=informationb>Password:</td>
<td><input class=input type=password name="Password" size="10"></td>
</tr>
<tr><td> </td></tr>
<tr><td> </td><td colspan=><input class=buttons type="submit"
value="Login" name="submit"></td></tr>
</table>
</center>
<input type="hidden" name="ValidationReq" value="1">
<input type="hidden" name="WhichBrowser" value="IE">
<input type="hidden" name="pgBrowserVersion" value="4">
</form>
</body>
</html>
<script Language="JavaScript">
document.forms["RequestForm"].elements["Login"].focus();
function CheckBlank(){
if (document.forms[0].Login.value == "" ||
document.forms[0].Password.value == ""){
window.alert("Please enter a valid user name and password");
return false;
}
else{
document.forms[0].WhichBrowser.value = navigator.appName;
document.forms[0].pgBrowserVersion.value = navigator.appVersion;
return true;
}
}
</script>
All I ever get in response, is the same page. No error, no nothing...
If I try with a browser and enter "bad" values for user/pw; i get a
slightly diff version saying bad user/pw (this I'm not getting with
the vb.net code)
Any help would be appreciated!! kinda on a tight deadline here...
Gill