Boolean value that indicates whether mutual authentication occurred.
using System;
using System.Net;
using System.IO;
class MainClass
{
public static void Main()
{
Uri resource = new Uri("http://www.google.com");
WebRequest request = (WebRequest)WebRequest.Create(resource);
//request.AuthenticationLevel = AuthenticationLevel.MutualAuthRequested;
request.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Console.WriteLine("Is mutually authenticated? {0}", response.IsMutuallyAuthenticated);
Stream streamResponse = response.GetResponseStream();
StreamReader streamRead = new StreamReader(streamResponse);
string responseString = streamRead.ReadToEnd();
Console.WriteLine(responseString);
streamResponse.Close();
streamRead.Close();
response.Close();
}
}
Related examples in the same category