473,569 Members | 2,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 .DefaultCredent ials. 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 4862
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 .DefaultCredent ials. 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********@joer gjooss.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 .DefaultCredent ials. 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********@joer gjooss.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********@joer gjooss.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********@joer gjooss.de
Nov 6 '06 #5
Thus wrote mr************* @gmail.com,
Sorry, but what do you mean by AD?
Active Directory.

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

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

Similar topics

4
5034
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 this true? In any case, I want to know how this problem can be solved. The code
2
6797
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. I want to download a file from my webapplication. I've learned that the NetworkCredential class gives a way to go but no luck. My code is as...
2
14085
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 errors on the HttpWebRequest.GetResponse statement. The remote server returned an error: (401) Unauthorized also, when I use the network...
2
8731
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 binary code; code not accessible). I send XML requests to it. If my request is accepted, ServerXMLHTTP returns XML with accept details. If my...
0
4274
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 container so it can be shared between requests so that authentication can be maintained Dim objCookieCont As New CookieContainer 'create request...
1
3945
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 System.Collections.Generic; using System.ComponentModel; using System.Data;
2
6033
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 <System.Web.Services.WebService(Namespace :=
2
2261
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 works fine for several pages that I've tried but for one of the pages I'm trying to get it returns 404 even though the page exists for sure - to make...
1
5642
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? HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.CookieContainer = new CookieContainer(); HttpCookie sessionCookie =...
0
7701
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
940
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.