public static void ValidateASPService(string Url)
{
// Create the ASP request, and fetch the http response
WebRequest Request = WebRequest.Create(new Uri(Url.TrimEnd('/') + "/ASP/getbackendinfo.aspx"));
HttpWebResponse Response = (HttpWebResponse)Request.GetResponse();
// Make sure that we connected successfully
if (Response.StatusCode != HttpStatusCode.OK)
throw new Exception("Unable to connect to the Gamespy ASP Webservice: " + Response.StatusDescription);
// Parse the response message
using (StreamReader Reader = new StreamReader(Response.GetResponseStream()))
{
// getunlockinfo.aspx always returns a valid response, starting with "O"
string Lines = Reader.ReadToEnd().TrimStart();
if (!Lines.StartsWith("O"))
throw new Exception("The ASP webserver didnt not respond with a proper ASP response!");
}
}