private static CookieCollection FetchLoginResponseCookies(string username, string password)
{
try
{
return LoginUri.GetResponseCookies(HttpMethod.Post, request =>
{
byte[] content = GetLoginRequestContent(username, password);
request.ContentType = AuthContentType;
request.ContentLength = content.Length;
request.Referer = LoginRequestReferer;
using(var stream = request.GetRequestStream())
{
stream.Write(content, 0, content.Length);
}
});
}
catch(IOException exc)
{
Log.Error(exc);
throw Guard.LiveAuthenticationService_FailedToFetchAuthToken(exc);
}
}