Hello,
I'm not sure if you can help me, but I try. I want to write an application (C#) to search in the auction house.
With "FireBug" I looked into the Battle.net login process and tried to reproduce it with C#. Unfortunately, this has not worked.
Perhaps it would help if I first show you the source code: the Battle.Net login (not perfect, but enough for a start).

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;
}
After the execution I have the "Login Key" in JSON format (picked out via substring) and 4 cookies (JSESSIONID, BA Tassadar, login.key, cl) in a cookie collection.
After Battle.Net Login I want to retrieve data from the auction house. This is 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 try this code, I get a 404 error at this line:
HttpWebResponse Response = (HttpWebResponse)Request.GetResponse();
Does anyone have any idea what I'm doing wrong?
Thank you in advance for help.