internal void PreAuthIfNeeded(HttpWebRequest httpWebRequest, ICredentials authInfo)
{
if (!this.TriedPreAuth)
{
this.TriedPreAuth = true;
if (authInfo != null)
{
this.PrepareState(httpWebRequest);
System.Net.Authorization authorization = null;
try
{
authorization = AuthenticationManager.PreAuthenticate(httpWebRequest, authInfo);
if ((authorization != null) && (authorization.Message != null))
{
this.UniqueGroupId = authorization.ConnectionGroupId;
httpWebRequest.Headers.Set(this.AuthorizationHeader, authorization.Message);
}
}
catch (Exception)
{
this.ClearSession(httpWebRequest);
}
}
}
}