Hello,
I'm not rly sure if you can help me... but I'll try
I want to make an application (c#) to search in the auction house. So I used firebug to look at the login process of battle.net and tryed to reproduce it. But I have a problem ...
That is my Login Function + SendPOSTRequest (not perfect at all but for the beginning ... )

public string Login(string AccountName, string Password)
{
string URL = "https://eu.battle.net/login/de/login.frag?secureOrigin=true";
string Post = "accountName=" + AccountName + "&password=" + Password;
string ServerResponse = SendPOSTRequest(URL, Post);
if (ServerResponse.IndexOf("success") > 0 && ServerResponse.IndexOf("loginTicket") > 0)
{
int Start = ServerResponse.IndexOf("loginTicket")+16;
ServerResponse = ServerResponse.Substring(Start);
int End = ServerResponse.IndexOf("\"}")-1;
ServerResponse = ServerResponse.Substring(0,End);
LoginKey = ServerResponse;
return ServerResponse;
}
return String.Empty;
}
private string SendPOSTRequest(string URL, string Post)
{
HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(URL);
Request.Method = "POST";
Request.ContentType = "application/x-www-form-urlencoded";
Request.CookieContainer = new CookieContainer();
Byte[] byteArray = Encoding.UTF8.GetBytes(Post);
Request.ContentLength = byteArray.Length;
Stream DataStream = Request.GetRequestStream();
DataStream.Write(byteArray, 0, byteArray.Length);
DataStream.Close();
HttpWebResponse Response = (HttpWebResponse)Request.GetResponse();
DataStream = Response.GetResponseStream();
cookies = Response.Cookies;
StreamReader reader = new StreamReader(DataStream);
string ServerResponse = reader.ReadToEnd();
reader.Close();
DataStream.Close();
Response.Close();
return ServerResponse;
}
I get back a Login-Key in JSON and 4 cookies (JSESSIONID, BA-tassadar, login.key, cl). I save the Login-Key in String and the cookies in a CookieCollection.
Now I want to go further and pull some Auctionhouse data... my code:
public string Test()
{
if (!LoginOK) return String.Empty;
string URL = "https://eu.battle.net/wow/de/vault/character/auction/alliance/?ST=" + LoginKey;
string ServerResponse = SendGETRequest(URL);
return ServerResponse;
}
private string SendGETRequest(string URL)
{
HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(URL);
Request.Method = "GET";
Request.CookieContainer = new CookieContainer();
Request.CookieContainer.Add(cookies);
HttpWebResponse Response = (HttpWebResponse)Request.GetResponse();
Stream DataStream = Response.GetResponseStream();
cookies = Response.Cookies;
StreamReader reader = new StreamReader(DataStream);
string ServerResponse = reader.ReadToEnd();
reader.Close();
DataStream.Close();
Response.Close();
return ServerResponse;
}
But every time I send this... I get an error 404 at:
HttpWebResponse Response = (HttpWebResponse)Request.GetResponse();
Do you know what's going wrong there?
Thanks a lot for your help!
Ramides