WebClient - input type="password"

  • Thread starter Thread starter mc kim via .NET 247
  • Start date Start date
M

mc kim via .NET 247

What I am trying to is automatic bidding process in Ebay site...

WebClient class can uploads form data easily.

I have collected ebay url & form data to uploads..
Most of process is quite easy and simple. But ebay webserver send me your password is not valid...
But the password is clearly correct.. you can type it at the result page and submit. Then you can see a message - bidding has ended and you are logged in. <- This is the message I want.

I can not find where is a wrong part. Some code is worng?? Or whole different way..? Please help me~~~~

here is the code------------------------------------------------------------

WebForm1.aspx--------------------------------------------------
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebClient.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 200px; POSITION: absolute; TOP: 32px" runat="server" Text="Button"></asp:Button>
</form>
</body>
</HTML>

WebForm1.aspx.cs--------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Net;
using System.Collections.Specialized;


namespace WebClient
{
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;



#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
//
InitializeComponent();
base.OnInit(e);
}


private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);

}
#endregion

private void Button1_Click(object sender, System.EventArgs e)
{
try
{
// Download the data to a buffer.

System.Net.WebClient client = new System.Net.WebClient();

//client.
Byte[] pageData = client.DownloadData("http://signin.ebay.com/ws1/eBayISAP...d=&quantity=1&maxbid=335&placebid=Bid+Again+>.");


WebHeaderCollection myWebHeaderCollection = client.ResponseHeaders;

for (int i=0; i < myWebHeaderCollection.Count; i++)
{
Response.Write(myWebHeaderCollection.GetKey(i) +":"+ myWebHeaderCollection.Get(i)+"<br>");
}


// Upload some form post values.
NameValueCollection form = new NameValueCollection();

Response.Write("-------------------------------------------------<br>");



// Add form data

form.Add("MfcISAPICommand", "MakeBid");
form.Add("item","5703948646");
form.Add("maxbid","US $335.00");
form.Add("quant","1");
form.Add("userid","");
form.Add("key","$2$13400446$NIvqcQYD7KdSclr65dbJk0");
form.Add("javascriptenabled","1");
form.Add("mode","1");

form.Add("user","kmmccc");

form.Add("pass","rlaaudcks");


Byte[] responseData = client.UploadValues("http://offer.ebay.com/ws/eBayISAPI.dll", form);

Response.Write( Encoding.ASCII.GetString(responseData));

}

catch (WebException webEx)
{
Response.Write( webEx.ToString());
}



}
}
}
 
You might want to sniff the session using a network sniffer. I would do the
following

1) USe the browser to do the same scenario. Capture the scenario using a
network sniffer.
2) Do the same using your code. capture it using a network sniffer.

now compare the two sniffs and see what the difference is. That should
explain why it is failing.

--

Thanks

feroze
=============
This posting is offered as-is. It offers no warranties and confers no
rights.

mc kim via .NET 247 said:
What I am trying to is automatic bidding process in Ebay site...

WebClient class can uploads form data easily.

I have collected ebay url & form data to uploads..
Most of process is quite easy and simple. But ebay webserver send me your password is not valid...
But the password is clearly correct.. you can type it at the result page
and submit. Then you can see a message - bidding has ended and you are
logged in. <- This is the message I want.
I can not find where is a wrong part. Some code is worng?? Or whole
different way..? Please help me~~~~
here is the code------------------------------------------------------------

WebForm1.aspx--------------------------------------------------
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="WebClient.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 200px; POSITION:
absolute; TOP: 32px" runat="server" Text="Button"> said:
</form>
</body>
</HTML>

WebForm1.aspx.cs--------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Net;
using System.Collections.Specialized;


namespace WebClient
{
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;



#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
//
InitializeComponent();
base.OnInit(e);
}


private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);

}
#endregion

private void Button1_Click(object sender, System.EventArgs e)
{
try
{
// Download the data to a buffer.

System.Net.WebClient client = new System.Net.WebClient();

//client.
Byte[] pageData = client.DownloadData("http://signin.ebay.com/ws1/eBayISAPI.dll?MfcISAPIComman
d=MakeBid&item=5703948646&co_partnerid=&quantity=1&maxbid=335&placebid=Bid+A
gain+%3E.");


WebHeaderCollection myWebHeaderCollection = client.ResponseHeaders;

for (int i=0; i < myWebHeaderCollection.Count; i++)
{
Response.Write(myWebHeaderCollection.GetKey(i) +":"+
myWebHeaderCollection.Get(i)+ said:
}


// Upload some form post values.
NameValueCollection form = new NameValueCollection();

Response.Write("-------------------------------------------------<br>");



// Add form data

form.Add("MfcISAPICommand", "MakeBid");
form.Add("item","5703948646");
form.Add("maxbid","US $335.00");
form.Add("quant","1");
form.Add("userid","");
form.Add("key","$2$13400446$NIvqcQYD7KdSclr65dbJk0");
form.Add("javascriptenabled","1");
form.Add("mode","1");

form.Add("user","kmmccc");

form.Add("pass","rlaaudcks");


Byte[] responseData =
client.UploadValues("http://offer.ebay.com/ws/eBayISAPI.dll", form);
 
mc said:
What I am trying to is automatic bidding process in Ebay site...

WebClient class can uploads form data easily.

I have collected ebay url & form data to uploads..
Most of process is quite easy and simple. But ebay webserver send me your
password is not valid...
But the password is clearly correct.. you can type it at the result page
and submit. Then you can see a message - bidding has ended and you are
logged in. <- This is the message I want.

I can not find where is a wrong part. Some code is worng?? Or whole
different way..? Please help me~~~~

here is the
code------------------------------------------------------------

WebForm1.aspx--------------------------------------------------
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="WebClient.WebForm1" %> <!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 200px; POSITION:
absolute; TOP: 32px" runat="server" Text="Button"></asp:Button> </form>
</body>
</HTML>

WebForm1.aspx.cs--------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Net;
using System.Collections.Specialized;


namespace WebClient
{
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;



#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
//
InitializeComponent();
base.OnInit(e);
}


private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);

}
#endregion

private void Button1_Click(object sender, System.EventArgs e)
{
try
{
// Download the data to a buffer.

System.Net.WebClient client = new System.Net.WebClient();

//client.
Byte[] pageData =
client.DownloadData("http://signin.ebay.com/ws1/eBayISAP...d=&quantity=1&maxbid=335&placebid=Bid+Again+>.");


WebHeaderCollection myWebHeaderCollection = client.ResponseHeaders;

for (int i=0; i < myWebHeaderCollection.Count; i++)
{
Response.Write(myWebHeaderCollection.GetKey(i) +":"+
myWebHeaderCollection.Get(i)+"<br>"); }


// Upload some form post values.
NameValueCollection form = new NameValueCollection();

Response.Write("-------------------------------------------------<br>");



// Add form data

form.Add("MfcISAPICommand", "MakeBid");
form.Add("item","5703948646");
form.Add("maxbid","US $335.00");
form.Add("quant","1");
form.Add("userid","");
form.Add("key","$2$13400446$NIvqcQYD7KdSclr65dbJk0");
form.Add("javascriptenabled","1");
form.Add("mode","1");

form.Add("user","kmmccc");

form.Add("pass","rlaaudcks");


Byte[] responseData =
client.UploadValues("http://offer.ebay.com/ws/eBayISAPI.dll", form);

Response.Write( Encoding.ASCII.GetString(responseData));

}

catch (WebException webEx)
{
Response.Write( webEx.ToString());
}



}
}
}
-------------------------------------------------------------------------------------
I would use https, and pass the userid and password as part of the http
protocol.
 
Back
Top