Hello,
I am trying to automatically login to websites after I have used SSO to get
the credentials. For my test, I am working with my Yahoo account. The code
that I am using is code that many have said works fine. I have done some
tweaking to fit my specific needs. The Problem is when I post to the My
Yahoo login page, the apparently the user name and password are being passed
because my user name is accepted, but I am told that there is an INVALID
PASSWORD. I know the password is correct because I use the account all the
time. Has anyone had this problem? Can anyone help me? Thank you in
advance.
Tony
Here is the code I am using:
void Page_Load(object sender, EventArgs e) {
string appURL = "http://login.yahoo.com/config/login";
string strPostData = String.Format("login={0}&password={1}",
"myloginname", "mypassword");
// Setup the http request.
HttpWebRequest wrWebRequest = WebRequest.Create(appURL) as
HttpWebRequest;
wrWebRequest.Method = "POST";
wrWebRequest.ContentLength = strPostData.Length;
wrWebRequest.ContentType = "application/x-www-form-urlencoded";
wrWebRequest.CookieContainer = new CookieContainer();
// Post to the login form.
StreamWriter swRequestWriter = new
StreamWriter(wrWebRequest.GetRequestStream());
swRequestWriter.Write(strPostData);
swRequestWriter.Close();
// Get the response.
HttpWebResponse hwrWebResponse =
(HttpWebResponse)wrWebRequest.GetResponse();
// Have some cookies.
CookieCollection ccCookies = hwrWebResponse.Cookies;
// Read the response
StreamReader srResponseReader = new
StreamReader(hwrWebResponse.GetResponseStream());
string strResponseData = srResponseReader.ReadToEnd();
srResponseReader.Close();
// Display the response.
Response.Write(strResponseData);
} 3 31650
Never mind. I figured it out.
Tony
"Tony Hunter" <to*********@misi.com> wrote in message
news:#V*************@TK2MSFTNGP10.phx.gbl... Hello,
I am trying to automatically login to websites after I have used SSO to
get the credentials. For my test, I am working with my Yahoo account. The
code that I am using is code that many have said works fine. I have done some tweaking to fit my specific needs. The Problem is when I post to the My Yahoo login page, the apparently the user name and password are being
passed because my user name is accepted, but I am told that there is an INVALID PASSWORD. I know the password is correct because I use the account all
the time. Has anyone had this problem? Can anyone help me? Thank you in advance.
Tony
Here is the code I am using:
void Page_Load(object sender, EventArgs e) {
string appURL = "http://login.yahoo.com/config/login"; string strPostData = String.Format("login={0}&password={1}", "myloginname", "mypassword");
// Setup the http request. HttpWebRequest wrWebRequest = WebRequest.Create(appURL) as HttpWebRequest; wrWebRequest.Method = "POST"; wrWebRequest.ContentLength = strPostData.Length; wrWebRequest.ContentType = "application/x-www-form-urlencoded"; wrWebRequest.CookieContainer = new CookieContainer();
// Post to the login form. StreamWriter swRequestWriter = new StreamWriter(wrWebRequest.GetRequestStream()); swRequestWriter.Write(strPostData); swRequestWriter.Close();
// Get the response. HttpWebResponse hwrWebResponse = (HttpWebResponse)wrWebRequest.GetResponse();
// Have some cookies. CookieCollection ccCookies = hwrWebResponse.Cookies;
// Read the response StreamReader srResponseReader = new StreamReader(hwrWebResponse.GetResponseStream()); string strResponseData = srResponseReader.ReadToEnd(); srResponseReader.Close();
// Display the response. Response.Write(strResponseData); }
Tony, so tell us.... What did it take to get it to work?
Alex
"Tony Hunter" wrote: Never mind. I figured it out.
Tony
"Tony Hunter" <to*********@misi.com> wrote in message news:#V*************@TK2MSFTNGP10.phx.gbl... Hello,
I am trying to automatically login to websites after I have used SSO to get the credentials. For my test, I am working with my Yahoo account. The code that I am using is code that many have said works fine. I have done some tweaking to fit my specific needs. The Problem is when I post to the My Yahoo login page, the apparently the user name and password are being passed because my user name is accepted, but I am told that there is an INVALID PASSWORD. I know the password is correct because I use the account all the time. Has anyone had this problem? Can anyone help me? Thank you in advance.
Tony
Here is the code I am using:
void Page_Load(object sender, EventArgs e) {
string appURL = "http://login.yahoo.com/config/login"; string strPostData = String.Format("login={0}&password={1}", "myloginname", "mypassword");
// Setup the http request. HttpWebRequest wrWebRequest = WebRequest.Create(appURL) as HttpWebRequest; wrWebRequest.Method = "POST"; wrWebRequest.ContentLength = strPostData.Length; wrWebRequest.ContentType = "application/x-www-form-urlencoded"; wrWebRequest.CookieContainer = new CookieContainer();
// Post to the login form. StreamWriter swRequestWriter = new StreamWriter(wrWebRequest.GetRequestStream()); swRequestWriter.Write(strPostData); swRequestWriter.Close();
// Get the response. HttpWebResponse hwrWebResponse = (HttpWebResponse)wrWebRequest.GetResponse();
// Have some cookies. CookieCollection ccCookies = hwrWebResponse.Cookies;
// Read the response StreamReader srResponseReader = new StreamReader(hwrWebResponse.GetResponseStream()); string strResponseData = srResponseReader.ReadToEnd(); srResponseReader.Close();
// Display the response. Response.Write(strResponseData); }
Here is the solution...try it
replace the part of your code by (not 'password'...will be 'passwd') -
string strPostData = String.Format("login={0}&passwd={1}",
"myloginname", "mypassword");
Enjoy !!!
Hello,
I am trying to automatically login to websites after I have used SSO to get
the credentials. For my test, I am working with my Yahoo account. The code
that I am using is code that many have said works fine. I have done some
tweaking to fit my specific needs. The Problem is when I post to the My
Yahoo login page, the apparently the user name and password are being passed
because my user name is accepted, but I am told that there is an INVALID
PASSWORD. I know the password is correct because I use the account all the
time. Has anyone had this problem? Can anyone help me? Thank you in
advance.
Tony
Here is the code I am using:
void Page_Load(object sender, EventArgs e) {
string appURL = "http://login.yahoo.com/config/login";
string strPostData = String.Format("login={0}&password={1}",
"myloginname", "mypassword");
// Setup the http request.
HttpWebRequest wrWebRequest = WebRequest.Create(appURL) as
HttpWebRequest;
wrWebRequest.Method = "POST";
wrWebRequest.ContentLength = strPostData.Length;
wrWebRequest.ContentType = "application/x-www-form-urlencoded";
wrWebRequest.CookieContainer = new CookieContainer();
// Post to the login form.
StreamWriter swRequestWriter = new
StreamWriter(wrWebRequest.GetRequestStream());
swRequestWriter.Write(strPostData);
swRequestWriter.Close();
// Get the response.
HttpWebResponse hwrWebResponse =
(HttpWebResponse)wrWebRequest.GetResponse();
// Have some cookies.
CookieCollection ccCookies = hwrWebResponse.Cookies;
// Read the response
StreamReader srResponseReader = new
StreamReader(hwrWebResponse.GetResponseStream());
string strResponseData = srResponseReader.ReadToEnd();
srResponseReader.Close();
// Display the response.
Response.Write(strResponseData);
}
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: james |
last post by:
How can I have a php script send data to a URL as form post data from
within the script without creating an actual form in a web page.
I am working with an affiliate program (from Affiliateshop)...
|
by: Jeremy Phillips |
last post by:
I am trying to build a web form that uses the "POST" method (too much
data for GET) to send data to a second form, then displays the
response of that form post. The second web form requires...
|
by: |
last post by:
Hi everyone,
I'm using VS.NET, Framework 1.1, Windows 2000 Server, IIS
5, all the latest patches are installed.
Im having this wierd random problem, that I cannot
reproduce but it happens...
|
by: Al Cadalzo |
last post by:
I'm trying to simulate a form post (i.e. Method="POST").
The FORM POST I'm trying to simulate is similar to this:
<FORM NAME=SearchForm METHOD=POST ACTION=Search>
<SELECT name="criteriaA" >...
|
by: Ron Vecchi |
last post by:
I know this has messiness written all over it but I have a question about
using HttpWebRequest/Response to essentially spider a website and post
information to the forms. The (very) basic goal is...
|
by: guoqi zheng |
last post by:
I know in webclient class, there is a possibility to post form data to a
remote url, but how can I not only just post, I need to redirect user to
that page as well.
So what I want is just like a...
|
by: John Braham |
last post by:
I have a slight wall headbutter which I'm hoping someone will have an
idea for (I'd be very grateful!).
Basically I'm trying to make a form post to an asp page programatically
from within VB.NET...
|
by: eggie5 |
last post by:
Is it possible to get a file without using a form post?
I want to get the data (bytes) of a file, text or binary, and just
save it to a variable. Similar to the post body of a form that has a...
|
by: shlim |
last post by:
Currently I'm using VB.Net to perform a http/https multipart form post to a servlet. I'm able to perform the post using HttpWebrequest via GetRequestStream(). However, the servlet returned me with...
|
by: magix |
last post by:
Hi,
I launched a modal popup window with code like:
<script language="javascript">
function modalWin() {
if (window.showModalDialog) {
window.showModalDialog("MyPage1.asp","MyPopup",...
|
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: 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: 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...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |