When I run the code below, the web server tells me that I need to
enable cookies. Can anyone tell me what might be causing that? I'm
trying to POST userid and password to their login web page. Thanks!
Dim CookieJar As CookieContainer = New CookieContainer ()
Dim WebReq As HttpWebRequest
Dim WebResp As HttpWebResponse
Dim StrmRdr As StreamReader
Dim StrmWrtr As StreamWriter
Dim PostParms As String
Dim URLString As String
Dim HTML as String
= "https://www.nordstromba nking.com/onlineserv/HB/Login.cgi"
WebReq = CType(WebReques t.Create(New Uri(URLString)) ,
HttpWebRequest)
WebReq.CookieCo ntainer = CookieJar
WebReq.Credenti als = CredentialCache .DefaultCredent ials
WebReq.UserAgen t = "Mozilla/4.0 (compatible; MSIE 6.0; Windows
NT 5.1; .NET CLR 1.0.3705)"
WebReq.KeepAliv e = True
WebReq.Headers. Set("Pragma", "no-cache")
WebReq.Timeout = 30000
WebReq.Method = "POST"
WebReq.ContentT ype = "applicatio n/x-www-form-urlencoded"
PostParms = "userNumber=123 45678&password= 87654321&OK=sub mit&"
& _
"runmode=SIGN_I N&LAST_ACTIVE_U RL="
WebReq.ContentL ength = PostParms.Lengt h
StrmWrtr = New StreamWriter(We bReq.GetRequest Stream)
StrmWrtr.Write( PostParms)
StrmWrtr.Close( )
WebResp = WebReq.GetRespo nse
StrmRdr = New StreamReader(We bResp.GetRespon seStream)
HTML = StrmRdr.ReadToE nd.Trim
StrmRdr.Close()
WebResp.Close()
The source for the web page is:
<meta http-equiv="Pragma" Content="no-cache">
<meta http-equiv="Expires" Content="Tuesda y, 14-Dec-1971 04:30:00
GMT">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<title>Intern et Banking Timeout</title> <!-- for non-nav pages -->
<!--
<script language="JavaS cript">
ldt = new Date;
inSubmit = 0;
function dofocus() {
document.Login. userNumber.focu s();
inSubmit = 0;
}
function clear() {
document.Login. userNumber.valu e = "";
document.Login. password.value = "";
dofocus();
}
function formField1()
{
Ctrl = document.Login. userNumber;
if (Ctrl.value == "")
{
validatePrompt (Ctrl, "Please enter a valid Customer Number.")
return (false);
}
else
return (true);
}
function formField2()
{
bName = navigator.appNa me; // get version of Navigator
bVer = parseInt(naviga tor.appVersion) ;
// if Netscape 2.0 or below just get out
if (bName == "Netscape" && bVer < 3)
return (true);
Ctrl = document.Login. password;
if (Ctrl.value == "")
{
validatePrompt (Ctrl, "Please enter a Password.")
return (false);
}
else
return (true);
}
function runSubmit (form)
{
if (!formField1())
return false;
if (!formField2())
return false;
// Due to the re-direct from the timeout warning, this no longer
works.
// form.LAST_ACTIV E_URL.value = window.location .search;
document.cookie = "signonValid=TR UE; path=/";
return true;
}
function validatePrompt (Ctrl, PromptStr)
{
alert(PromptStr );
Ctrl.focus();
return;
}
// -->
</script>
</head>
<body bgcolor=white leftmargin=3 onload="dofocus ()">
<div align="center">
<br><br>
<span class="mainTitl e">Internet Banking Timeout</span>
<form autocomplete="O FF" name="Login" method="post"
action="./Login.cgi" onsubmit="retur n runSubmit(this) ">
<table width="500" border="0">
<tr>
<td valign="top">
<span class="subtitle ">For security reasons, your Internet Banking
session has timed out. Please login again by entering your customer
number and password here...<BR><BR> If you would like to increase your
session timeout please do so by clicking on the User Options button
inside of Internet Banking.</span>
<br><br>
</td>
<td valign="top" width="15"><br> </td>
<td valign="top">
<table border="1">
<tr>
<td align="center">
<span class="sectionT itle">Customer Number</span><br>
<input type="hidden" name="runmode" value="SIGN_IN" >
<input type="hidden" name="LAST_ACTI VE_URL" value="">
<input name="userNumbe r" size="16" maxlength="32">
</td>
</tr>
<tr>
<td align=center>
<span class="sectionT itle">Password</span><br>
<input type="password" name="password" size="16" maxlength="8">
</td>
</tr>
<tr>
<td align="center" valign="middle" >
<input name="OK" type="submit" value=" Enter ">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</div>
<!-- end of IB Timeout -->
</body>
</html>
enable cookies. Can anyone tell me what might be causing that? I'm
trying to POST userid and password to their login web page. Thanks!
Dim CookieJar As CookieContainer = New CookieContainer ()
Dim WebReq As HttpWebRequest
Dim WebResp As HttpWebResponse
Dim StrmRdr As StreamReader
Dim StrmWrtr As StreamWriter
Dim PostParms As String
Dim URLString As String
Dim HTML as String
= "https://www.nordstromba nking.com/onlineserv/HB/Login.cgi"
WebReq = CType(WebReques t.Create(New Uri(URLString)) ,
HttpWebRequest)
WebReq.CookieCo ntainer = CookieJar
WebReq.Credenti als = CredentialCache .DefaultCredent ials
WebReq.UserAgen t = "Mozilla/4.0 (compatible; MSIE 6.0; Windows
NT 5.1; .NET CLR 1.0.3705)"
WebReq.KeepAliv e = True
WebReq.Headers. Set("Pragma", "no-cache")
WebReq.Timeout = 30000
WebReq.Method = "POST"
WebReq.ContentT ype = "applicatio n/x-www-form-urlencoded"
PostParms = "userNumber=123 45678&password= 87654321&OK=sub mit&"
& _
"runmode=SIGN_I N&LAST_ACTIVE_U RL="
WebReq.ContentL ength = PostParms.Lengt h
StrmWrtr = New StreamWriter(We bReq.GetRequest Stream)
StrmWrtr.Write( PostParms)
StrmWrtr.Close( )
WebResp = WebReq.GetRespo nse
StrmRdr = New StreamReader(We bResp.GetRespon seStream)
HTML = StrmRdr.ReadToE nd.Trim
StrmRdr.Close()
WebResp.Close()
The source for the web page is:
<meta http-equiv="Pragma" Content="no-cache">
<meta http-equiv="Expires" Content="Tuesda y, 14-Dec-1971 04:30:00
GMT">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<title>Intern et Banking Timeout</title> <!-- for non-nav pages -->
<!--
<script language="JavaS cript">
ldt = new Date;
inSubmit = 0;
function dofocus() {
document.Login. userNumber.focu s();
inSubmit = 0;
}
function clear() {
document.Login. userNumber.valu e = "";
document.Login. password.value = "";
dofocus();
}
function formField1()
{
Ctrl = document.Login. userNumber;
if (Ctrl.value == "")
{
validatePrompt (Ctrl, "Please enter a valid Customer Number.")
return (false);
}
else
return (true);
}
function formField2()
{
bName = navigator.appNa me; // get version of Navigator
bVer = parseInt(naviga tor.appVersion) ;
// if Netscape 2.0 or below just get out
if (bName == "Netscape" && bVer < 3)
return (true);
Ctrl = document.Login. password;
if (Ctrl.value == "")
{
validatePrompt (Ctrl, "Please enter a Password.")
return (false);
}
else
return (true);
}
function runSubmit (form)
{
if (!formField1())
return false;
if (!formField2())
return false;
// Due to the re-direct from the timeout warning, this no longer
works.
// form.LAST_ACTIV E_URL.value = window.location .search;
document.cookie = "signonValid=TR UE; path=/";
return true;
}
function validatePrompt (Ctrl, PromptStr)
{
alert(PromptStr );
Ctrl.focus();
return;
}
// -->
</script>
</head>
<body bgcolor=white leftmargin=3 onload="dofocus ()">
<div align="center">
<br><br>
<span class="mainTitl e">Internet Banking Timeout</span>
<form autocomplete="O FF" name="Login" method="post"
action="./Login.cgi" onsubmit="retur n runSubmit(this) ">
<table width="500" border="0">
<tr>
<td valign="top">
<span class="subtitle ">For security reasons, your Internet Banking
session has timed out. Please login again by entering your customer
number and password here...<BR><BR> If you would like to increase your
session timeout please do so by clicking on the User Options button
inside of Internet Banking.</span>
<br><br>
</td>
<td valign="top" width="15"><br> </td>
<td valign="top">
<table border="1">
<tr>
<td align="center">
<span class="sectionT itle">Customer Number</span><br>
<input type="hidden" name="runmode" value="SIGN_IN" >
<input type="hidden" name="LAST_ACTI VE_URL" value="">
<input name="userNumbe r" size="16" maxlength="32">
</td>
</tr>
<tr>
<td align=center>
<span class="sectionT itle">Password</span><br>
<input type="password" name="password" size="16" maxlength="8">
</td>
</tr>
<tr>
<td align="center" valign="middle" >
<input name="OK" type="submit" value=" Enter ">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</div>
<!-- end of IB Timeout -->
</body>
</html>
Comment