/// <summary>Calls each registered authentication module to find the first module that can respond to the authentication request.</summary> /// <returns>An instance of the <see cref="T:System.Net.Authorization" /> class containing the result of the authorization attempt. If there is no authentication module to respond to the challenge, this method returns null.</returns> /// <param name="challenge">The challenge returned by the Internet resource. </param> /// <param name="request">The <see cref="T:System.Net.WebRequest" /> that initiated the authentication challenge. </param> /// <param name="credentials">The <see cref="T:System.Net.ICredentials" /> associated with this request. </param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="challenge" /> is null.-or- <paramref name="request" /> is null.-or- <paramref name="credentials" /> is null. </exception> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" /> /// </PermissionSet> public static Authorization Authenticate(string challenge, WebRequest request, ICredentials credentials) { if (request == null) { throw new ArgumentNullException("request"); } if (credentials == null) { throw new ArgumentNullException("credentials"); } if (challenge == null) { throw new ArgumentNullException("challenge"); } return(AuthenticationManager.DoAuthenticate(challenge, request, credentials)); }