473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

trying to login into https web site via <WhatEverWorks>.net

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>&nbsp</td></tr>
<tr><td>&nbsp</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
Nov 20 '05 #1
3 5187
not sure why your URL is coded for GET call while your are obviously trying
to do a POST call.

The receiving end may be confused by that.

Also, since this an HTTPS session, and the server is probably load balanced,
you will need to get the Login page, collect the cookies, and send them back
on the POST request and all subsequent requests. This is nearly always a
requirement, because load balancers can provide the SSL decoding most
efficiently when they can piggyback a session variable to determine which
system is connected once SSL is stripped off.

Hope this helps,
--- Nick

"Gill Bates" <gi********@hotmail.com> wrote in message
news:8e**************************@posting.google.c om...
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&Va
lidationReq=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>&nbsp</td></tr>
<tr><td>&nbsp</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

Nov 20 '05 #2
Indeed; it helped enormously!

I now have a working prototype; it was the Cookie that did the trick…
I had played around with the code until it was pretty screwed up in
the GET/POST ‘ing; that's now taken care of.

For any other poor souls; here's the working code… (needs polish)…

Thanks so much!!
Dim cookieJar As CookieContainer = New CookieContainer
Dim webReq As HttpWebRequest
Dim webResp As HttpWebResponse
Dim sr As StreamReader
Dim sw As StreamWriter
Dim payLoad As String
Dim txt As String
webReq = CType(WebRequest.Create(New Uri(urlString)),
HttpWebRequest)
webReq.CookieContainer = cookieJar
webReq.Credentials = CredentialCache.DefaultCredentials
webReq.UserAgent = "BGClient"
webReq.KeepAlive = True
webReq.Headers.Set("Pragma", "no-cache")
webReq.Timeout = 5000
webReq.Method = "GET"

' get login page
webResp = webReq.GetResponse

sr = New StreamReader(webResp.GetResponseStream)
txt = sr.ReadToEnd.Trim
sr.Close()
webResp.Close()

webReq = CType(WebRequest.Create(New Uri(urlString & uriString)),
HttpWebRequest)
webReq.CookieContainer = cookieJar
webReq.Credentials = CredentialCache.DefaultCredentials
webReq.UserAgent = "BGClient"
webReq.KeepAlive = True
webReq.Headers.Set("Pragma", "no-cache")
webReq.Timeout = 5000
webReq.Method = "POST"
webReq.ContentType = "application/x-www-form-urlencoded"

payLoad = "Login=gill&Password=bates&submit=Login&Validation Req=1&WhichBrowser=Microsoft+Internet+Explorer&pgB rowserVersion=4.0+(compatible;+MSIE+6.0;+Windows+N T+5.1;+.NET+CLR+1.1.4322;+.NET+CLR+1.0.3705)"

webReq.ContentLength = payLoad.Length
sw = New StreamWriter(webReq.GetRequestStream)
sw.Write(payLoad)
sw.Close()

' post login parms
webResp = webReq.GetResponse

sr = New StreamReader(webResp.GetResponseStream)
txt = sr.ReadToEnd.Trim
sr.Close()
webResp.Close()

"Nick Malik" <ni*******@hotmail.nospam.com> wrote in message news:<3usOc.197831$JR4.26384@attbi_s54>...
not sure why your URL is coded for GET call while your are obviously trying
to do a POST call.

The receiving end may be confused by that.

Also, since this an HTTPS session, and the server is probably load balanced,
you will need to get the Login page, collect the cookies, and send them back
on the POST request and all subsequent requests. This is nearly always a
requirement, because load balancers can provide the SSL decoding most
efficiently when they can piggyback a session variable to determine which
system is connected once SSL is stripped off.

Hope this helps,
--- Nick

"Gill Bates" <gi********@hotmail.com> wrote in message
news:8e**************************@posting.google.c om...
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

etc....

Nov 20 '05 #3
Indeed; it helped enormously!

I now have a working prototype; it was the Cookie that did the trick…
I had played around with the code until it was pretty screwed up in
the GET/POST ‘ing; that's now taken care of.

For any other poor souls; here's the working code… (needs polish)…

Thanks so much!!
Dim cookieJar As CookieContainer = New CookieContainer
Dim webReq As HttpWebRequest
Dim webResp As HttpWebResponse
Dim sr As StreamReader
Dim sw As StreamWriter
Dim payLoad As String
Dim txt As String
webReq = CType(WebRequest.Create(New Uri(urlString)),
HttpWebRequest)
webReq.CookieContainer = cookieJar
webReq.Credentials = CredentialCache.DefaultCredentials
webReq.UserAgent = "BGClient"
webReq.KeepAlive = True
webReq.Headers.Set("Pragma", "no-cache")
webReq.Timeout = 5000
webReq.Method = "GET"

' get login page
webResp = webReq.GetResponse

sr = New StreamReader(webResp.GetResponseStream)
txt = sr.ReadToEnd.Trim
sr.Close()
webResp.Close()

webReq = CType(WebRequest.Create(New Uri(urlString & uriString)),
HttpWebRequest)
webReq.CookieContainer = cookieJar
webReq.Credentials = CredentialCache.DefaultCredentials
webReq.UserAgent = "BGClient"
webReq.KeepAlive = True
webReq.Headers.Set("Pragma", "no-cache")
webReq.Timeout = 5000
webReq.Method = "POST"
webReq.ContentType = "application/x-www-form-urlencoded"

payLoad = "Login=gill&Password=bates&submit=Login&Validation Req=1&WhichBrowser=Microsoft+Internet+Explorer&pgB rowserVersion=4.0+(compatible;+MSIE+6.0;+Windows+N T+5.1;+.NET+CLR+1.1.4322;+.NET+CLR+1.0.3705)"

webReq.ContentLength = payLoad.Length
sw = New StreamWriter(webReq.GetRequestStream)
sw.Write(payLoad)
sw.Close()

' post login parms
webResp = webReq.GetResponse

sr = New StreamReader(webResp.GetResponseStream)
txt = sr.ReadToEnd.Trim
sr.Close()
webResp.Close()

"Nick Malik" <ni*******@hotmail.nospam.com> wrote in message news:<3usOc.197831$JR4.26384@attbi_s54>...
not sure why your URL is coded for GET call while your are obviously trying
to do a POST call.

The receiving end may be confused by that.

Also, since this an HTTPS session, and the server is probably load balanced,
you will need to get the Login page, collect the cookies, and send them back
on the POST request and all subsequent requests. This is nearly always a
requirement, because load balancers can provide the SSL decoding most
efficiently when they can piggyback a session variable to determine which
system is connected once SSL is stripped off.

Hope this helps,
--- Nick

"Gill Bates" <gi********@hotmail.com> wrote in message
news:8e**************************@posting.google.c om...
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

etc....

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gill Bates | last post by:
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.