The following program works fine with OpenURL but does not read file when worked with CHttpConnection. It catches the exception & does not come in the read part.<br>Can somebody please help me?<br>Zulfi.<br><br><br>void CQueryDlg::OnOK() <br>{<br> // TODO: Add extra validation here<br> const CString http = "<A HREF=" TARGET="_new"> UpdateData(TRUE);<br> m_out = "";<br> UpdateData(FALSE);<br> TryURL(http + m_Host);<br> TryURL(http + "<A HREF=" TARGET="_new"> + m_Host);<br> CDialog::OnOK();<br>}<br><br>void CQueryDlg::TryURL(CString URL)<br>{<br> m_out = "Trying " + URL + "\r\n";<br> UpdateData(FALSE);<br><br> CInternetSession sess;<br> CHttpConnection* pHttpConnect = NULL;<br> CHttpFile* pFile = NULL;<br><br> try {<br> pHttpConnect = sess.GetHttpConnection(URL);<br> pFile = pHttpConnect->OpenRequest(CHttpConnection::HTTP_VERB_GET, "/"<br> pFile->SendRequest();<br> }<br> catch(CInternetException* pEx) {<br> pFile = NULL;<br> pEx->Delete();<br> }<br><br> if (pFile) {<br> CString line;<br> for (int i=0; i<600 && pFile->ReadString(line); i++)<br> m_out += line + "\r\n";<br> pFile->Close();<br> delete pFile;<br> }<br> <br> if (pHttpConnect != NULL)<br> delete pHttpConnect;<br>}<br><br>