Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
microsoft.public.dotnet.framework.sdk
WebClient - input type="password"
Robin Prosch via .NET 247
6/14/2004 11:43:00 AM
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/eBayISAPI.dll?MfcISAPICommand=MakeBid&item=5703948646&co_partnerid=&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...
, form);
Response.Write( Encoding.ASCII.GetString(responseData));
}
catch (WebException webEx)
{
Response.Write( webEx.ToString());
}
}
}
}
-------------------------------------------------------------------------------------
--------------------------------
From: mc kim in Korea
-----------------------
Posted by a user from .NET 247 (
http://www.dotn...
)
<Id>BygXo6W9wkS6cGnMSoEm0A==</Id>
1 Answer
feroze [msft]
7/1/2004 8:37:00 AM
0
It is difficult to say what is going wrong.
the best way to get this working is to sniff the session when you login with
a browser. Then make sure you do the exact same thing when using weblclient
or httpwebrequest/response objects.
feroze
================
"mc kim via .NET 247" <anonymous@dotnet247.com> wrote in message
news:%23GnrPQfUEHA.808@tk2msftngp13.phx.gbl...
> 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/eBayISAPI.dll?MfcI...
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)+"<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...
, form);
>
> Response.Write( Encoding.ASCII.GetString(responseData));
>
> }
>
> catch (WebException webEx)
> {
> Response.Write( webEx.ToString());
> }
>
>
>
> }
> }
> }
> --------------------------------------------------------------------------
-----------
>
> --------------------------------
> From: mc kim in Korea
>
> -----------------------
> Posted by a user from .NET 247 (
http://www.dotn...
)
>
> <Id>BygXo6W9wkS6cGnMSoEm0A==</Id>
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
WebClient - input type="password"
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password