Hi
I have the code below that I am using to login to my remote webpage.
The problem is that it seems to not post the data. I have heard that
ViewState can be a problem and that it may be necessary to retrieve the
ViewState field and Post it with the data, i have attempted test this by
copying the viewstate text out of the source and into the start of the
variable strPostData - as you can see commented out.
I am unsure why I do not get forwarded from the adminlogin.aspx page after
posting the data, could this be the viewstate or another issue?
Any advice would be much appreciated.
Thanks
B
Dim strURL As String
Dim strPostData As String
Dim byteResponse() As Byte
Dim i As Integer
Dim strViewState As String
strURL = strHttpLocation & "adminlogin.asp x"
strPostData =
"UsernameTextBo x=username&Pass wordTextBox=123 4&LoginButton=L ogin"
'strPostData =
"__VIEWSTATE=dD wtNDU0NDA4NTk3O zs+hQAoe3316Ljm 9GtmhxCl3GsRZjw =&UsernameTextB ox=username&Pas swordTextBox=12 34&LoginButton= Login"
'login
gobjWebClient.H eaders.Add("Con tent-Type",
"applicatio n/x-www-form-urlencoded")
byteResponse = gobjWebClient.U ploadData(strUR L, "POST",
System.Text.Enc oding.ASCII.Get Bytes(strPostDa ta))
TextBox1.Text = System.Text.Enc oding.ASCII.Get String(byteResp onse)