Jerry Rhodes wrote:[color=blue]
> 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.nordstrombanking.com/onlineserv/HB/Login.cgi"
>
> WebReq = CType(WebRequest.Create(New Uri(URLString)),
> HttpWebRequest)
> WebReq.CookieContainer = CookieJar
> WebReq.Credentials = CredentialCache.DefaultCredentials
> WebReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows
> NT 5.1; .NET CLR 1.0.3705)"
> WebReq.KeepAlive = True
> WebReq.Headers.Set("Pragma", "no-cache")
> WebReq.Timeout = 30000
> WebReq.Method = "POST"
> WebReq.ContentType = "application/x-www-form-urlencoded"
> PostParms = "userNumber=12345678&password=87654321&OK=subm it&"
> & _
> "runmode=SIGN_IN&LAST_ACTIVE_URL="
> WebReq.ContentLength = PostParms.Length
> StrmWrtr = New StreamWriter(WebReq.GetRequestStream)
> StrmWrtr.Write(PostParms)
> StrmWrtr.Close()
> WebResp = WebReq.GetResponse
> StrmRdr = New StreamReader(WebResp.GetResponseStream)
> HTML = StrmRdr.ReadToEnd.Trim
> StrmRdr.Close()
> WebResp.Close()
>
> The source for the web page is:[/color]
[...][color=blue]
> 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_ACTIVE_URL.value = window.location.search;
> document.cookie = "signonValid=TRUE; path=/";[/color]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[color=blue]
> return true;
> }[/color]
Ah, the josys of remote controlling some third-party web app ;-)
You didn't reverse engineer the web form completely. Your code does not set
this cookie. Adding it to your cookie container should do the trick.
Cheers,
--
Joerg Jooss
joerg.jooss@gmx.net