Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / July 2004

Tip: Looking for answers? Try searching our database.

WebClient - input type="password"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mc kim - 14 Jun 2004 10:43 GMT
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+%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.dll", form);
   
                Response.Write( Encoding.ASCII.GetString(responseData));
   
            }
   
            catch (WebException webEx)
            {
                Response.Write( webEx.ToString());
            }

        }
    }
}
-------------------------------------------------------------------------------------
feroze [msft] - 01 Jul 2004 07:37 GMT
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
================

> What I am trying to is automatic bidding process in Ebay site...
>
[quoted text clipped - 3 lines]
> 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~~~~
>
[quoted text clipped - 67 lines]
> //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;
>
[quoted text clipped - 45 lines]
>
> <Id>BygXo6W9wkS6cGnMSoEm0A==</Id

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.