This sample illustrates using the WebRequest and WebResponse classes to make a GET request on a URI with NTLM authentication.
</P>
<P>
This sample is very similar to the clientGET.cs sample. The difference is in the addition of the SingleCredentials object to handle setting a username, password, and domain to allow for NTLM authentication. Other authentication types are also just as easy. A <B>SingleCredentials</B> object is created with a username, password, and domain sent in the constructor. The object is then attached to the <B>WebRequest</B> object's <B>Credentials</B> property. And that is it!
</P>
<P>
The function getPage is where the specific details of making the request can be found. The rest of the code in this sample is for taking command-line parameters, and displaying help usage for the parameters as well. This sample program is a command-line utility that runs at the command prompt.
</P>
<P>
The <B>getPage</B> function takes a string parameter, which is the URL (or URI) of the web page to request. This URI is then included as a parameter in a call to <B>WebRequestFactory.Create</B> which creates a <B>WebRequest</B> object.
</P>
<P>
The <B>GetResponse</B> function of the WebRequest object is then used to get a <B>WebResponse</B> object. This object can be used to get the status code of the response, as well as the actual response stream, for instance a web page.
</P>
<P>
Actually writing out the stream can take several different forms. This example reads a byte array (of 512 bytes) into the Byte[] variable <B>read</B> with the <B>Read</B> function. It then writes out the 512 bytes with a Console.WriteLine function: Console.Write(System.Text.Encoding.ASCII.GetString(read, 0, bytes));