HttpWebRequest with ssl problem


G

Guest

Hi support

I' m sending requests to a web server over an ssl connection to a server
with the HttpWebRequest class. I can't control the server. I make a login,
send some requests but the server has no logout. This works only once. The
second time I get a http error. I restart the application and everything
works fine again.

The programmer of the server application advised me to just destroy the ssl
connection and after that log in again. That's the point: how can I destroy
the ssl connection in visual basic.net.

Regards

Dieter
 
Ad

Advertisements

J

Joerg Jooss

Andiego said:
Hi support

I' m sending requests to a web server over an ssl connection to a
server with the HttpWebRequest class. I can't control the server. I
make a login, send some requests but the server has no logout. This
works only once. The second time I get a http error. I restart the
application and everything works fine again.

The programmer of the server application advised me to just destroy
the ssl connection and after that log in again. That's the point: how
can I destroy the ssl connection in visual basic.net.

Can you be more specific about the error you receive, and post some
code as well?

Cheers,
 
G

Guest

Thanks for the reply
The big advantage of the HttpWebRequest is, that you don't have to bother
about SSL. It just works. So, my code is the standard code you find in a lot
of code samples in the internet.
The error is the internal server error (500) which is very useful :)
Because it works every time I restart I think the server programmer is right
when he say that I have to reset the ssl connection and that's what I want to
try.
I have build many interfaces to different servers and it was always easy
with the HttpWebRequest. The big difference was that all of them had a logout
function which resetted the connection. I can't tell our customers to restart
to program when they want to connect a second time.

Regards

Dieter
 
F

Feroze [msft]

Are you setting any cookies on the HttpWebRequest? if so, can you try
removing the cookiecontainer and setting a new one for the subsequent
request?

If not, you might want to try setting a unique connectiongroupname
everytime, like so:

request.ConnectionGroupName = "SSL_Group_" + Environment.TickCount;

This will cause a new connection to be opened everytime a request is sent.
If your app is long running, then you might have a situation where there are
multiple idle connections from your client machine to the server. They will
get closed when GC happens, but there is no guarantee that it will happen
regularly (unless you force it by GC.Collect()).

Anyway, try these two options and see what happens.
 
Ad

Advertisements

J

Joerg Jooss

Andiego said:
Thanks for the reply
The big advantage of the HttpWebRequest is, that you don't have to
bother about SSL. >It just works. So, my code is the standard code you
find in a lot of code samples in the internet.
Ok...

The error is the internal server error (500) which is very useful :)

That's clearly an error on the server-side. And as you've said, you're
using some run-of-the-mill client side code. I guess you're trying to
fix problem on the wrong side ;-)
Because it works every time I restart I think the server programmer
is right when he say that I have to reset the ssl connection and
that's what I want to try.

What do you mean by "reset"? Close?
I have build many interfaces to different servers and it was always
easy with the HttpWebRequest. The big difference was that all of them
had a logout function which resetted the connection.

I really don't think so. Web application technologies like ASP.NET or
Servlets don't really expose connections to application code, as these
are low-level resources managed by the web application server. HTTP
gives you some control over TCP connection management, so you want
connections closed after each request/response exchange, disable
persistent connections on the client-side.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top