Hello. Have been losing plenty of hair over problem whereby I can't
make it off the login page. Trying to pass login info to a login page
and then move on to another page within the site so that I can download
some data, but I keep getting the login page.
Any ideas on this?
Here's the code:
==================================================
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim httpRequest As HttpWebRequest =
CType(WebRequest.Create("http://www.idirect.co.jp/"), HttpWebRequest)
Dim responseReader As StreamReader = New
StreamReader(httpRequest.GetResponse.GetResponseSt ream)
Dim responseData As String = responseReader.ReadToEnd
responseReader.Close()
Dim viewState As String = ExtractViewState(responseData)
Dim postData As String =
"iDirectLogin_userID=USERID&iDirectLogin_userPass= PASSWORD"
Dim cookies As CookieContainer = New CookieContainer
httpRequest =
CType(WebRequest.Create("http://www.idirect.co.jp/"), HttpWebRequest)
httpRequest.Method = "POST"
httpRequest.KeepAlive = True
httpRequest.Timeout = 120 * 1000
httpRequest.ContentType = "application/x-www-form-urlencoded"
httpRequest.CookieContainer = cookies
Dim requestWriter As StreamWriter = New
StreamWriter(httpRequest.GetRequestStream)
requestWriter.Write(postData)
requestWriter.Close()
httpRequest.GetResponse.Close()
httpRequest =
CType(WebRequest.Create("http://www.idirect.co.jp/search.aspx"),
HttpWebRequest)
httpRequest.CookieContainer = cookies
responseReader = New
StreamReader(httpRequest.GetResponse.GetResponseSt ream)
' and read the response
responseData = responseReader.ReadToEnd
responseReader.Close()
Response.Write(responseData)
End Sub
==================================
Here's what's in the form:
<input name="iDirectLogin:userID" type="text" id="iDirectLogin_userID"
style="width:100px;WIDTH: 100px" /></td>
<input name="iDirectLogin:userPass" type="password"
id="iDirectLogin_userPass" style="width:100px;WIDTH: 100px" /></td>
<input type="submit" name="iDirectLogin:btnLogIn" value="Log-In"
id="iDirectLogin_btnLogIn" class="button" style="width:80px;" />
Any help would be greatly appreciated.
Regards,
adwooley2 2 5551
Hello adwooley2,
Hello. Have been losing plenty of hair over problem whereby I can't
make it off the login page. Trying to pass login info to a login page
and then move on to another page within the site so that I can
download
some data, but I keep getting the login page.
Any ideas on this?
Here's the code:
==================================================
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim httpRequest As HttpWebRequest =
CType(WebRequest.Create("http://www.idirect.co.jp/"), HttpWebRequest)
Dim responseReader As StreamReader = New
StreamReader(httpRequest.GetResponse.GetResponseSt ream)
Dim responseData As String = responseReader.ReadToEnd
responseReader.Close()
Dim viewState As String = ExtractViewState(responseData)
Dim postData As String =
"iDirectLogin_userID=USERID&iDirectLogin_userPass= PASSWORD"
Dim cookies As CookieContainer = New CookieContainer
httpRequest =
CType(WebRequest.Create("http://www.idirect.co.jp/"), HttpWebRequest)
httpRequest.Method = "POST"
httpRequest.KeepAlive = True
httpRequest.Timeout = 120 * 1000
httpRequest.ContentType = "application/x-www-form-urlencoded"
httpRequest.CookieContainer = cookies
Dim requestWriter As StreamWriter = New
StreamWriter(httpRequest.GetRequestStream)
requestWriter.Write(postData)
requestWriter.Close()
httpRequest.GetResponse.Close()
httpRequest =
CType(WebRequest.Create("http://www.idirect.co.jp/search.aspx"),
HttpWebRequest)
httpRequest.CookieContainer = cookies
responseReader = New
StreamReader(httpRequest.GetResponse.GetResponseSt ream)
' and read the response
responseData = responseReader.ReadToEnd
responseReader.Close()
Response.Write(responseData)
End Sub
==================================
Here's what's in the form:
<input name="iDirectLogin:userID" type="text" id="iDirectLogin_userID"
style="width:100px;WIDTH: 100px" /></td>
<input name="iDirectLogin:userPass" type="password"
id="iDirectLogin_userPass" style="width:100px;WIDTH: 100px" /></td>
<input type="submit" name="iDirectLogin:btnLogIn" value="Log-In"
id="iDirectLogin_btnLogIn" class="button" style="width:80px;" />
Any help would be greatly appreciated. Regards,
It sounds like you are not persisting the principal 's token in the cookies
for the subsequent request. I'm not sure I can help much, but just wanted
to say I love your username ;)
Jim Wooley http://devauthority.com/blogs/jwooley/default.aspx
Thanks Jim. Not sure where I'll go with this, but appreciate the
reply.
Yes, nice name indeed. I live in Japan currently, and the
pronunciation of my last name always trips up the Japanese.
Rgds,
adwooley2
Jim Wooley wrote:
Hello adwooley2,
Hello. Have been losing plenty of hair over problem whereby I can't
make it off the login page. Trying to pass login info to a login page
and then move on to another page within the site so that I can
download
some data, but I keep getting the login page.
Any ideas on this?
Here's the code:
==================================================
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim httpRequest As HttpWebRequest =
CType(WebRequest.Create("http://www.idirect.co.jp/"), HttpWebRequest)
Dim responseReader As StreamReader = New
StreamReader(httpRequest.GetResponse.GetResponseSt ream)
Dim responseData As String = responseReader.ReadToEnd
responseReader.Close()
Dim viewState As String = ExtractViewState(responseData)
Dim postData As String =
"iDirectLogin_userID=USERID&iDirectLogin_userPass= PASSWORD"
Dim cookies As CookieContainer = New CookieContainer
httpRequest =
CType(WebRequest.Create("http://www.idirect.co.jp/"), HttpWebRequest)
httpRequest.Method = "POST"
httpRequest.KeepAlive = True
httpRequest.Timeout = 120 * 1000
httpRequest.ContentType = "application/x-www-form-urlencoded"
httpRequest.CookieContainer = cookies
Dim requestWriter As StreamWriter = New
StreamWriter(httpRequest.GetRequestStream)
requestWriter.Write(postData)
requestWriter.Close()
httpRequest.GetResponse.Close()
httpRequest =
CType(WebRequest.Create("http://www.idirect.co.jp/search.aspx"),
HttpWebRequest)
httpRequest.CookieContainer = cookies
responseReader = New
StreamReader(httpRequest.GetResponse.GetResponseSt ream)
' and read the response
responseData = responseReader.ReadToEnd
responseReader.Close()
Response.Write(responseData)
End Sub
==================================
Here's what's in the form:
<input name="iDirectLogin:userID" type="text" id="iDirectLogin_userID"
style="width:100px;WIDTH: 100px" /></td>
<input name="iDirectLogin:userPass" type="password"
id="iDirectLogin_userPass" style="width:100px;WIDTH: 100px" /></td>
<input type="submit" name="iDirectLogin:btnLogIn" value="Log-In"
id="iDirectLogin_btnLogIn" class="button" style="width:80px;" />
Any help would be greatly appreciated. Regards,
It sounds like you are not persisting the principal 's token in the cookies
for the subsequent request. I'm not sure I can help much, but just wanted
to say I love your username ;)
Jim Wooley http://devauthority.com/blogs/jwooley/default.aspx This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: love_norip |
last post by:
I have encountered a problem when I try to visit a web page (like
http://www.xxx.org....?arg1=x&arg2=x&....) using HttpWebRequest and
HttpWebResponse and related methods .NET provides.The code is...
|
by: buran |
last post by:
Dear ASP.NET Programmers,
How can I post data to an ASP.NET login page and pass authentication? The
login page uses forms
authentication, users must supply usernames and password and have to...
|
by: Iggy Evans |
last post by:
Hi
My app is trying to login to an ASP.NET site that uses Forms authentication. I am trying to do in my app (what was previously posted in a newsgroup) the same that a browser does
3) The browser...
|
by: n8 |
last post by:
Hi,
Hi have to do the followign and have been racking my brain with
various solutions that have had no so great results.
I want to use the System.Net.WebClient to submit data to a form (log a...
|
by: Denise |
last post by:
I have posted a similar message in 2 other forums but got no response. I
have spent more hours than I can count researching this. Can anyone provide
some insight...?
Our ASP.Net application...
|
by: shankararaman.s |
last post by:
Hi,
I am trying to develop an interface which will fetch all my Yahoo
mails. I am not able to sign in to yahoo by posting the form with my
username & password. Please find my code below and...
|
by: msnews.microsoft.com |
last post by:
I have been raking my brains on why this does not work. I get back the same
login screen again instead of the home page redirection which should occur
after a successful login:
'create a cookie...
|
by: AppleBag |
last post by:
I'm having the worst time trying to login to myspace through code. Can
someone tell me how to do this? Please try it yourself before replying,
only because I have asked this a couple of times in...
|
by: barrybevel |
last post by:
Hi,
I'm trying to login to the www.vodafone.ie website using
HttpWebRequest.
It works fine with IE/Firefox and the .NET Web Control too, just not
with my code.
I think it's a redirect 302...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |