Problems with NetworkCredientials in HttpWebRequest

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi I'm using the code below to post to a web form, but when I run it, i
get System.Net.WebException: The operation has timed-out.
error

Obviously something is wrong, can anyone give me a clue?

string url = "http://localhost/testapp/test.asp";;
HttpWebRequest myHttpWebRequest =
(HttpWebRequest)WebRequest.Create(url);
myHttpWebRequest.Credentials = new NetworkCredential("username",
"password", null);
myHttpWebRequest.Method = "POST";
try
{
HttpWebResponse myHttpWebResponse =
(HttpWebResponse)myHttpWebRequest.GetResponse();
}
catch (Exception e)
{
Response.Write (e.ToString();)
}

Thanks in advance for any help you can give.
Mark

.



Relevant Pages

  • Problems with NetworkCredientials in HttpWebRequest
    ... Hi I'm using the code below to post to a web form, but when I run it, i ... get System.Net.WebException: The operation has timed-out. ... HttpWebRequest myHttpWebRequest = ... POST request. ...
    (microsoft.public.dotnet.general)
  • Re: Problems with NetworkCredientials in HttpWebRequest
    ... get System.Net.WebException: The operation has timed-out. ... can anyone give me a clue? ... string url = "http://localhost/testapp/test.asp";; ... HttpWebRequest myHttpWebRequest = ...
    (microsoft.public.dotnet.languages.csharp)