How does NetworkCredential work in C # when assigned to an HttpRequest object?

I want to know how NetworkCredentials are transmitted through an HTTP request. They are transmitted as HTTPHeaders, RequestData or is there something else that carries the information.

I tried to create a sample application and checked the script logs. I do not see that this is being added as an HTTPHeader, and what this information carries.

Here is an example of the code I tried:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://gmail.com");
request.Method = "GET";
request.ContentType = "application/json";
request.UserAgent = "Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0";
request.Credentials = new NetworkCredential("TestUser", "Password-1");
+4
source share
1 answer

On the following MSDN page:

Supported authentication schemes include Digest, Negotiate, Kerberos, NTLM, and Basic. https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.credentials(v=vs.110).aspx

, , , , ... :

HttpWebRequest , CredentialCache

, , , , CredentialCache;

https://msdn.microsoft.com/en-us/library/system.net.credentialcache(v=vs.110).aspx

0

Source: https://habr.com/ru/post/1676144/


All Articles