G
Guest
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&userid={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
{
}
}
}
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&userid={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
{
}
}
}