As there are lot's of contents to talk about in C# network programming, in this article I am going to talk only a bit on the WebRequest/WebResponse briefly.
The simplest example use "GET" method to request a uri:
eg.
var request=WebRequest.Create("http://...");
We can set the request properties, such as:
request.Credentials=CredentialCache.DefaultCredentials;
sometimes need use network credentials:(request.Credentials=new NetworkCredential(UserName, Password))
Sometimes we need to specify the Authentication lvl, such as:
request.AuthenticationLevel=System.Net.Security.AuthenticationLevel.MutualAuthRequested;
For the AuthenticationLevel, it can be None, MutualAuthRequested, MutualAuthRequired. which means no authentication, need client side authentication, and both server and client sides authentication mechanism.
No comments:
Post a Comment