Boolean value that indicates whether mutual authentication occurred. : Web Request Response « Network « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Date Time
8.Design Patterns
9.Development Class
10.Event
11.File Stream
12.Generics
13.GUI Windows Form
14.Internationalization I18N
15.Language Basics
16.LINQ
17.Network
18.Office
19.Reflection
20.Regular Expressions
21.Security
22.Services Event
23.Thread
24.Web Services
25.Windows
26.Windows Presentation Foundation
27.XML
28.XML LINQ
C# / C Sharp » Network » Web Request ResponseScreenshots 
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
1.Uses WebRequest and WebResponse. Tests use HTTP and the file protocol
2.Get HTTP Request Headers
3.Get HTTP Response headers
4.Provides a response from a Uniform Resource Identifier (URI).
5.Gets or sets the content length of data being received.
6.Returns the data stream from the Internet resource.
7.Gets a collection of header name-value pairs associated with this request.
8.Gets the URI of the Internet resource that actually responded to the request.
9.Create a new instance of the WebRequest class.
10.Initializes a new WebRequest instance for the specified URI scheme.
11.Create WebRequest instance for the specified URI scheme.
12.Gets or sets the network credentials used for authenticating the request with the Internet resource.
13.Returns a response to an Internet request.
14.Gets or sets the collection of header name/value pairs associated with the request.
15.Indicates whether to pre-authenticate the request.
16.Gets the URI of the Internet resource associated with the request.
17.Send Request By Post
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.