First call to HttpWebRequest.GetResponse() takes forever and fails, after that it works?
- From: mr.newsgroupguy@xxxxxxxxx
- Date: 1 Nov 2006 07:48:04 -0800
I am working in C# .NET 1.1. My app has a button on its main form that
checks to see if it has access to a file on our server, just an XML
file. On our server we are running W2K IIS with a virtual directory,
set to Windows Authentication. I am creating an HTTPWebRequest object
on the client, and setting its Credentials to
CredentialCache.DefaultCredentials. Also, I have tried numerous
Timeout settings, but they have not made a difference.
When I run the app on a client that is connected to our internal
network, everything works great. When I try and run through a client
that is connected through the Internet, and come in through a secure
tunnel, it takes forever and then fails the first time, but if we try
again without closing the app, it works every time there after.
Now, first off I have noticed while tracing the port that the call to
GetResponse() first returns a 401 error, but then it authenticates and
goes through, the same from both clients. I have noticed in the forums
that people have mentioned that GetResponse() actually may get a 401
error first so that the client can then send authentication.
When I use IE to access the URL to this file from the client on the
Internet, it works the first time and is fast.
What I have had to do to remedy the situation for now is test the
return value I get from my first check, and if it fails, I repeat it.
It still has the time delay but it ends up connecting without making
the user click twice.
What is wrong with GetResponse()? What else can I try to change to
have it connect the first time?
Thanks in advance,
Scott
.
- Follow-Ups:
- Prev by Date: Re: C++ to C#
- Next by Date: Re: Insert Byte array to SQL Server using string
- Previous by thread: if else in datagrid item template
- Next by thread: Re: First call to HttpWebRequest.GetResponse() takes forever and fails, after that it works?
- Index(es):
Relevant Pages
|