Downloading from website in c#

I can log into the URL using chrome (not IE) with the username and password.  Obviously I've changed those details for this public forum.
When I run the code below I get this error.
The underlying connection was closed: An unexpected error occurred on a send.

What am I doing wrong?
I'm using C# with .Net framework 3.5
Which IP address should I enter?

                    StringBuilder url = new StringBuilder("");
                    request = (HttpWebRequest)WebRequest.Create(url.ToString());

                    request.UserAgent = "Chrome/IPAddress";
                    request.Method = "POST";
                    request.ContentType = "application/x-www-form-urlencoded";
                    request.KeepAlive = true;
                    request.Headers.Add("Keep-Alive: 600");
                    request.Credentials = CredentialCache.DefaultCredentials;
                    //ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;//Or SecurityProtocolType.Ssl3
                    request.CookieContainer = new CookieContainer();
                    response = (HttpWebResponse)request.GetResponse();
                    if (response.StatusCode != HttpStatusCode.OK)
                        request.KeepAlive = false;
                        return false;
                    Console.WriteLine("Connection Succeeded...");
                    return true;

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
Nothing. This is normally a network or server issue. Ask the server admin.
AlHal2Author Commented:
Given that the link works when I log in myself, it wouldn't seem to be a firewall issue.  Therefore, I'm not sure how to phrase the question.  I'm also new to the httpwebrequest class.
Please could you help?
ste5anSenior DeveloperCommented:
Well, you need to look at the network layer. Use Fiddler to track the HTTP traffic and WireShark or Paketyzer to track the low-level network traffic.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

AlHal2Author Commented:
I'll accept this answer, but was wondering if there is something I can show to our IT security and legal departments confirming that it's safe and legal to use these pieces of software.
ste5anSenior DeveloperCommented:
hmm, this is a completley different problem. But what was the reason for the original problem?
AlHal2Author Commented:
I don't know anything about networks and am not sure how to phrase the question to those that do.  All I've asked is whether they've heard of Fiddler  and most have not.  The only person who has heard of it has never used it.
Therefore, I don't know the reason for the original and still outstanding problem.
ste5anSenior DeveloperCommented:
Ah ja. But the should know WireShark. Which should be sufficient, so use it. It's just more complex than Fiddler.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.