For Programmers: Free Programming Magazines  


Home > Archive > MSDN > November 2004 > Problem Getting Exception with GetHttpConnection









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem Getting Exception with GetHttpConnection
Sriram

2004-11-24, 8:55 am

Hi,
I have a small fragment of code as shown below.

My Problem is eventhough the server address is not valid.

I am not getting an exception.


How to get an error if the server does not exist or connection has
failed or unable to connect.

Please Advice.


regards,
ram
try {
CInternetSession *session = NULL;
session = new CInternetSession();
CHttpConnection *connection = NULL;
connection = session->GetHttpConnection( server, 80 );
file = connection->OpenRequest(1, path);
CString strRequestHeader = "Authorization: Basic ";
strRequestHeader += EncodeBase64(login + _T(":") +
password);
file->AddRequestHeaders(strRequestHeader);
file->SendRequest();
.........
delete session;
}
catch (CInternetException, pEx)
{
/* Exception Handling here */
}
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com