473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

HttpWebRequest,ebay,Cookie!

Hello!

This is my problem: I would like acces to my ebay account with post data.
I have a problem with cookie.
The registration in the ebay website work well after there is an error" you
navigator doesn't accept cookie"
I have try to cookiecontainer without success.
If you try the ebayname and ebaypassword aren't good.

If you have any idea!

Best regards,

Wavemill

HttpWebRequest request =
(HttpWebRequest)WebRequest.Create("http://www.ebay.fr");

request.ContentType = "application/x-www-form-urlencoded";
request.Method = "GET";
CookieContainer myCookie = new CookieContainer();
request.CookieContainer = myCookie;

HttpWebResponse res = (HttpWebResponse)request.GetResponse();

StreamReader resStream = new
StreamReader(res.GetResponseStream());

string responseStr = resStream.ReadToEnd();
resStream.Close();
res.Close();

try
{
string EbayUsername = "login";
string EbayPassword = "password";
string PostData =
string.Format("MfcISAPICommand=SignInWelcome&useri d={0}&pass={1}",
EbayUsername, EbayPassword);

HttpWebRequest myReq =
(HttpWebRequest)WebRequest.Create("http://signin.ebay.fr/aw-cgi/eBayISAPI.dll");
myReq.Method = "POST";
myReq.CookieContainer = myCookie;

myReq.ContentType = "application/x-www-form-urlencoded";
myReq.ContentLength = PostData.Length;
myReq.KeepAlive = true;

Stream OutStream = myReq.GetRequestStream();
try
{
ASCIIEncoding encoder = new ASCIIEncoding();
byte[] baPostData = encoder.GetBytes(PostData);
OutStream.Write(baPostData, 0, baPostData.Length);
}
finally
{
OutStream.Close();
}

using (WebResponse response = myReq.GetResponse())
{
try
{
// Get the stream associated with the response.
using (Stream receiveStream =
response.GetResponseStream())
{
using (StreamWriter sw = new
StreamWriter(@"C:\Documents and Settings\Berdoues\Desktop\zz.htm"))
{
// Pipes the stream to a higher level stream
reader with the required encoding format.
using (StreamReader readStream = new
StreamReader(receiveStream, Encoding.UTF8))
{
this.webBrowser.DocumentText =
readStream.ReadToEnd();
/*foreach (Cookie cook in res.Cookies)
{
this.textBox1.Text += cook.Value +
"/n/n";
}*/
}
}
}
}
finally
{
response.Close();
}
}
}
finally
{
}
}
}
Mar 8 '06 #1
3 1474
Thus wrote wavemill,
Hello!

This is my problem: I would like acces to my ebay account with post
data.
I have a problem with cookie.
The registration in the ebay website work well after there is an
error" you
navigator doesn't accept cookie"
I have try to cookiecontainer without success.
If you try the ebayname and ebaypassword aren't good.
If you have any idea!


eBay probably checks the browser type (i.e. User-Agent HTTP header). Set
HttpWebRequest.UserAgent to a well known UA string. You can find a nice list
at http://en.wikipedia.org/wiki/User_agent.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Mar 8 '06 #2
Hello!

Thank you for your ansxer!

I have try with:
myReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
..NET CLR 1.1.4322)";

But without succes!

If you have an other idea!
I have search in the web without succes!

Best regards,

Wavemill
Mar 10 '06 #3
Thus wrote wavemill,
Hello!

Thank you for your ansxer!

I have try with:
myReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1;
.NET CLR 1.1.4322)";
But without succes!

If you have an other idea!
I have search in the web without succes!
Best regards,


I suggest you use Fiddler to capture the HTTP traffic while you access the
site using a web browser, and program a sequence of HttpWebRequests according
to that capture.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Mar 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Satinderpal Singh | last post by:
Hi everyone, We are using HttpWebRequest to create a request to a URI, which requires us to login first. In order to process all the transactions, first we have to login and get the cookie value...
10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
6
by: omyek | last post by:
I'm trying to mimic the browsing of a webpage using an HttpWebRequest. I've had a lot of luck with it so far, including logging into pages, posting form data, and even collecting and using cookies....
1
by: Satinderpal Singh | last post by:
Hi everyone, We are using HttpWebRequest to create a request to a URI, which requires us to login first. In order to process all the transactions, first we have to login and get the cookie value...
14
by: tomer | last post by:
Clear DayHello, I have implemented a download manger in .NET that overrides Internet Explorer's bult-in download manager. I using HttpWebRequest/Response to download the files. All is working...
2
by: Keith Patrick | last post by:
I'm trying to programmatically post data to another page within my ASP.Net app. Not POSTing is not an option (I can't store this data in my session, context, hidden fields, or anything else...I've...
11
by: Keith Patrick | last post by:
Could someone explain to me the relationship between these two classes? I am ripping my hair out trying to divert an HttpRequest to a new location via an HttpWebRequest, but I cannot get my...
0
by: Alex Papadimoulis | last post by:
Hey Group, I'm in the process of converting an ASP-based site to an ASP.NET site and built a control that wraps around an ASP page. The control simply does a GET to the same server to render the...
0
by: Alex Papadimoulis | last post by:
Hey Group, I'm in the process of converting an ASP-based site to an ASP.NET site and built a control that wraps around an ASP page. The control simply does a GET to the same server to render the...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
Oralloy
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.