Click here to Skip to main content
15,903,030 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi, in my app I'm trying to establish a FTP connection using:
theApp.m_pConn = m_Session.GetFtpConnection(ip, usr, pwd, INTERNET_INVALID_PORT_NUMBER, FALSE );
// Note:
// CFtpConnection* m_pConn;
// CInternetSession m_Sesion;
// and ip,usr,pwd are CString's.  

In debug mode I track down the line where it crashes:
ASSERT_KINDOF(CInternetSession, pSession);


Any help would be really appreciated.

[edit]replaced <code> tags with <pre> tags for readability[/edit]

Here is the code snippet:
C++
try {                                    // try to connect
    theApp.m_pConn = m_Session.GetFtpConnection(ip, usr, pwd, INTERNET_INVALID_PORT_NUMBER, FALSE );
}
catch (CInternetException* pEx) {        // catch errors from WinINet
    TCHAR szErr[1024];
    if (pEx->GetErrorMessage(szErr, 1024))
    {
        AfxMessageBox(szErr);
        pEx->Delete();
        theApp.m_pConn = NULL;
        return;
    }
    else
    {
        str.Format(CTXT_CONN_ERROR,"%s",name);
        //AfxMessageBox(str);
        ShowMsg(str);
    }
    pEx->Delete();
    theApp.m_pConn = NULL;
}
Posted
Updated 24-Sep-10 2:27am
v4
Comments
Richard MacCutchan 24-Sep-10 7:53am    
What is the value of pSession?
josip cagalj 24-Sep-10 8:03am    
You mean m_Session.
It's a member variable declared in .h file. It has no value, I mean this is where it's first used.
Richard MacCutchan 24-Sep-10 8:26am    
No, I mean pSession as shown in your ASSERT_KINDOF statement above, which does not appear in the code block you posted.
josip cagalj 24-Sep-10 8:33am    
This is what I copied from quickWatch:
pSession | 0x0013b480 {CList<hinstance__ *,hinstance__="" *="">} | CInternetSession *
josip cagalj 24-Sep-10 8:36am    
{CList<hinstance__ *,hinstance__="" *="">}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900