login to site and download a file?
<p>I have implanted a login code to a site  , after that I want to download a file from a server . </p>

<pre><code>    HttpWebRequest http = WebRequest.Create(@"http://www.website.com") as HttpWebRequest;
    //    http.Connection = "Keep-alive"; //uncertain
    http.Method = "POST";
    http.ContentType = "application/x-www-form-urlencoded";
    string postData = "FormNameForUserId=" + @"username" + "&amp;FormNameForPassword=" + "pass";
    byte[] dataBytes = UTF8Encoding.UTF8.GetBytes(postData);
    http.ContentLength = dataBytes.Length;
    using (Stream postStream = http.GetRequestStream())
    {
        postStream.Write(dataBytes, 0, dataBytes.Length);
    }
    HttpWebResponse httpResponse = http.GetResponse() as HttpWebResponse;
    // Probably want to inspect the http.Headers here first
    http = WebRequest.Create(@"http://www.codeproject.com") as HttpWebRequest;
    http.CookieContainer = new CookieContainer();
    http.CookieContainer.Add(httpResponse.Cookies);
    HttpWebResponse httpResponse2 = http.GetResponse() as HttpWebResponse;
</code></pre>

<p>How can I find out I have loged in correctly , also What should I do after login to download a file ?</p>
