Click here to Skip to main content
15,906,645 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I downloaded the source code from :
A web based FTP client[^]

i was able to connect to my ftp server and see the list of the directories but as soon as i select a file and click download i get this error :

NullreferenceException was unhanled by user

the error in this line :



C#
protected void grdDetailView_RowCommand(object sender, GridViewCommandEventArgs e)
    {

        byte[] _downFile = FTP.DownloadFileFromFtp(e.CommandArgument.ToString());
        string _fname = e.CommandArgument.ToString();
        Response.ContentType = "application/" + Server.MapPath("filename.ext");

        Response.ContentType = "application/" + _fname.Split('.')[1];
        Response.AddHeader("Content-disposition", "attachment; filename=" + _fname);
        Response.OutputStream.Write(_downFile, 0, _downFile.Length);
        Response.End();


    }



Please i will appreciate any help I'm a student and i have a project to do and i want to integrate this ftp to my project website asp.net.

Thanks in advance.
Posted
Comments
Nelek 28-Oct-12 18:58pm    
You should ask the autor in the board placed below the article. He will get a notification when you write a message there.

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