473,372 Members | 837 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

First call to HttpWebRequest.GetResponse() takes forever and fails, after that it works?

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

Nov 1 '06 #1
5 4837
Thus wrote mr*************@gmail.com,
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.
I would check this behaviour using a network sniffer like Wireshark.
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.
That's how HTTP authentication works and not specific to HttpWebRequest.
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?
You can save all but the first challenge/response exchanges if you set HttpWebRequest.PreAuthenticate
to true.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Nov 2 '06 #2
Well I want to have the network people here tell me exactly were my
connection is stopping. They are trying to tell me that it is my
application, not the network but the have yet to provide me with the
details.. I think they are full of it considering that I am doing one
of the simplest things you can with HTTP, a GetResponse(). They put a
sniffer on it and the first attempt by the client never reaches my
server, but the subsequent ones do. I wonder if this could be a
problem with our switches?

Thanks

Joerg Jooss wrote:
Thus wrote mr*************@gmail.com,
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.

I would check this behaviour using a network sniffer like Wireshark.
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.

That's how HTTP authentication works and not specific to HttpWebRequest.
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?

You can save all but the first challenge/response exchanges if you set HttpWebRequest.PreAuthenticate
to true.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Nov 2 '06 #3
Thus wrote mr*************@gmail.com,
Well I want to have the network people here tell me exactly were my
connection is stopping. They are trying to tell me that it is my
application, not the network but the have yet to provide me with the
details.. I think they are full of it considering that I am doing one
of the simplest things you can with HTTP, a GetResponse(). They put a
sniffer on it and the first attempt by the client never reaches my
server, but the subsequent ones do. I wonder if this could be a
problem with our switches?
Well, it is probably related to the fact that you're using a VPN connection
-- maybe you're waiting to get authenticated by your AD?

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Nov 3 '06 #4
Sorry, but what do you mean by AD?

Thanks,
Scott

Joerg Jooss wrote:
Thus wrote mr*************@gmail.com,
Well I want to have the network people here tell me exactly were my
connection is stopping. They are trying to tell me that it is my
application, not the network but the have yet to provide me with the
details.. I think they are full of it considering that I am doing one
of the simplest things you can with HTTP, a GetResponse(). They put a
sniffer on it and the first attempt by the client never reaches my
server, but the subsequent ones do. I wonder if this could be a
problem with our switches?

Well, it is probably related to the fact that you're using a VPN connection
-- maybe you're waiting to get authenticated by your AD?

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Nov 6 '06 #5
Thus wrote mr*************@gmail.com,
Sorry, but what do you mean by AD?
Active Directory.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Nov 6 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Steven Pu | last post by:
Hi, Specifically, the website I am trying to access is, https://gmail.google.com/ I've read elsewhere that Google only uses SSL2, while .NET uses SSL3 and is not backward compatible. Is...
2
by: TK | last post by:
I have a trouble to get web resopnse from an aspx page which is secured by Forms Authentication with custom user account database. My client application is a console application but not a browser....
2
by: Steve Richter | last post by:
I have a page that uses simple HTTP GET to do an ISBN lookup via Amazon.com. The page works when I run it from //localhost. But I have moved it to my godaddy.com shared hoster site, and I get...
2
by: Maris Janis Vasilevskis | last post by:
Hi, Is it possible to force HttpWebRequest to do exactly (not approximately) the same as MSXML2.ServerXMLHTTP does? More details. I port JScript to JScript.NET I have a server (ASP invoking...
0
by: msnews.microsoft.com | last post by:
I have been raking my brains on why this does not work. I get back the same login screen again instead of the home page redirection which should occur after a successful login: 'create a cookie...
1
by: bliz_87 | last post by:
Hello all, I'm trying to create a simple application that does a HTTP request/response on a button click. Here's the entire code which I got from a reference book: using...
2
by: hharry | last post by:
hello all, trying to consume a simple web service using httpwebrequest instead of generating a proxy class. code for simple web service: Imports System.Web.Services ...
2
by: wajih.boukaram | last post by:
Hi I've been using asp.net for a couple of days now and i think I've gotten the hang of things I do have a problem when using HttpWebRequest: i request a page from a remote server and this...
1
by: ALA | last post by:
Hi, does anybody know if it is possible to pass the SessionID with a web request by using a cookie so that the invoked page in the same domain can access the session objects of the current user?...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.