Click here to Skip to main content
11,575,600 members (62,670 online)
   

ASP.NET

 
Questionbutton disable until all required fields are filled Pin
Member 870181320-Feb-13 7:12
memberMember 870181320-Feb-13 7:12 
AnswerRe: button disable until all required fields are filled Pin
Sandeep Mewara20-Feb-13 17:13
mvpSandeep Mewara20-Feb-13 17:13 
GeneralRe: button disable until all required fields are filled Pin
Member 870181320-Feb-13 20:04
memberMember 870181320-Feb-13 20:04 
GeneralRe: button disable until all required fields are filled Pin
Sandeep Mewara20-Feb-13 21:42
mvpSandeep Mewara20-Feb-13 21:42 
GeneralRe: button disable until all required fields are filled Pin
Member 870181320-Feb-13 21:57
memberMember 870181320-Feb-13 21:57 
GeneralRe: button disable until all required fields are filled Pin
Sandeep Mewara20-Feb-13 22:55
mvpSandeep Mewara20-Feb-13 22:55 
GeneralRe: button disable until all required fields are filled Pin
Member 870181321-Feb-13 2:07
memberMember 870181321-Feb-13 2:07 
GeneralRe: button disable until all required fields are filled Pin
Member 870181321-Feb-13 5:00
memberMember 870181321-Feb-13 5:00 
GeneralRe: button disable until all required fields are filled Pin
Member 870181320-Feb-13 22:09
memberMember 870181320-Feb-13 22:09 
QuestionPlease Wait .... Pin
jojoba201119-Feb-13 21:19
memberjojoba201119-Feb-13 21:19 
AnswerRe: Please Wait .... Pin
Sandeep Mewara19-Feb-13 22:11
mvpSandeep Mewara19-Feb-13 22:11 
AnswerRe: Please Wait .... Pin
Karthik Harve20-Feb-13 19:07
memberKarthik Harve20-Feb-13 19:07 
QuestionRe: Please Wait .... Pin
jojoba201122-Feb-13 23:26
memberjojoba201122-Feb-13 23:26 
Questionftp uploaded files are empty Pin
Omid Reza Aryafar19-Feb-13 2:43
memberOmid Reza Aryafar19-Feb-13 2:43 
Hi every one,

strange issue, im trying to upload a whole simple one-page asp.net website to a remote ftp by my method called uploadFolderContents().

every structure and files gets uploade, but the contents of files are gone. all of them are empty even txt files.

i tried to upload a single txt file, the file appears on remote but empty as well.
oh, it also changes the source files, makes them all empty too!!!!

some hlp pls


            clsFile.ftp ftp = new clsFile.ftp("ftp", "un", "pwd");
            ftp.uploadFolderContents("httpdocs/omid", "E:\\omid");


public bool uploadFolderContents(string remoteFolder, string localFolder)
        {
            bool rslt = false;
 
            try
            {
                string[] files = Directory.GetFiles(localFolder);
                string[] dirs = Directory.GetDirectories(localFolder);
                foreach (string file in files)
                {
                    uploadFile(remoteFolder + "/" + Path.GetFileName(file), file);
                }
                foreach (string dir in dirs)
                {
                    createFolder(remoteFolder + "/" + Path.GetFileName(dir));
                    uploadFolderContents(remoteFolder + "/" + Path.GetFileName(dir), dir);
                }
 
                rslt = true;
            }
            catch (Exception)
            {
                rslt = false;
            }
 
            return rslt;
        }


public void uploadFile(string remoteFile, string localFile)
{
    try
    {
        /* Create an FTP Request */
        ftpRequest = (FtpWebRequest)FtpWebRequest.Create(host + "/" + remoteFile);
        /* Log in to the FTP Server with the User Name and Password Provided */
        ftpRequest.Credentials = new NetworkCredential(user, pass);
        /* When in doubt, use these options */
        ftpRequest.UseBinary = true;
        ftpRequest.UsePassive = true;
        ftpRequest.KeepAlive = true;
        /* Specify the Type of FTP Request */
        ftpRequest.Method = WebRequestMethods.Ftp.UploadFile;
        /* Establish Return Communication with the FTP Server */
        ftpStream = ftpRequest.GetRequestStream();
        /* Open a File Stream to Read the File for Upload */
        FileStream localFileStream = new FileStream(localFile, FileMode.Create);
        /* Buffer for the Downloaded Data */
        byte[] byteBuffer = new byte[bufferSize];
        int bytesSent = localFileStream.Read(byteBuffer, 0, bufferSize);
        /* Upload the File by Sending the Buffered Data Until the Transfer is Complete */
        try
        {
            while (bytesSent != 0)
            {
                ftpStream.Write(byteBuffer, 0, bytesSent);
                bytesSent = localFileStream.Read(byteBuffer, 0, bufferSize);
            }
        }
        catch (Exception ex) { Console.WriteLine(ex.ToString()); }
        /* Resource Cleanup */
        localFileStream.Close();
        ftpStream.Close();
        ftpRequest = null;
    }
    catch (Exception ex) { Console.WriteLine(ex.ToString()); }
    return;
}


modified 19-Feb-13 8:55am.

AnswerRe: ftp uploaded files are empty Pin
Richard Deeming19-Feb-13 4:17
memberRichard Deeming19-Feb-13 4:17 
GeneralRe: ftp uploaded files are empty Pin
Omid Reza Aryafar19-Feb-13 4:34
memberOmid Reza Aryafar19-Feb-13 4:34 
QuestionCan a Compare validator fire when either of two controls changes? Pin
darookie9918-Feb-13 17:13
memberdarookie9918-Feb-13 17:13 
AnswerRe: Can a Compare validator fire when either of two controls changes? Pin
Brij18-Feb-13 19:09
mentorBrij18-Feb-13 19:09 
GeneralRe: Can a Compare validator fire when either of two controls changes? Pin
darookie9919-Feb-13 13:51
memberdarookie9919-Feb-13 13:51 
AnswerRe: Can a Compare validator fire when either of two controls changes? Pin
ryanb3119-Feb-13 2:32
memberryanb3119-Feb-13 2:32 
AnswerRe: Can a Compare validator fire when either of two controls changes? Pin
Keith Barrow19-Feb-13 4:07
mentorKeith Barrow19-Feb-13 4:07 
Questionmultilanguage application Pin
Member 870181318-Feb-13 7:39
memberMember 870181318-Feb-13 7:39 
AnswerRe: multilanguage application Pin
Sandeep Mewara18-Feb-13 7:58
mvpSandeep Mewara18-Feb-13 7:58 
GeneralRe: multilanguage application Pin
Member 870181325-Feb-13 21:59
memberMember 870181325-Feb-13 21:59 
GeneralRe: multilanguage application Pin
Sandeep Mewara25-Feb-13 23:24
mvpSandeep Mewara25-Feb-13 23:24 
GeneralRe: multilanguage application Pin
Member 870181326-Feb-13 1:44
memberMember 870181326-Feb-13 1:44 
GeneralRe: multilanguage application Pin
Sandeep Mewara26-Feb-13 2:04
mvpSandeep Mewara26-Feb-13 2:04 
GeneralRe: multilanguage application Pin
Member 870181326-Feb-13 2:51
memberMember 870181326-Feb-13 2:51 
GeneralRe: multilanguage application Pin
Member 870181326-Feb-13 5:20
memberMember 870181326-Feb-13 5:20 
AnswerRe: multilanguage application Pin
Sandeep Mewara26-Feb-13 5:38
mvpSandeep Mewara26-Feb-13 5:38 
GeneralRe: multilanguage application Pin
Member 870181327-Feb-13 4:38
memberMember 870181327-Feb-13 4:38 
GeneralRe: multilanguage application Pin
Sandeep Mewara27-Feb-13 4:48
mvpSandeep Mewara27-Feb-13 4:48 
GeneralRe: multilanguage application Pin
Member 870181327-Feb-13 6:24
memberMember 870181327-Feb-13 6:24 
GeneralRe: multilanguage application Pin
Sandeep Mewara27-Feb-13 6:28
mvpSandeep Mewara27-Feb-13 6:28 
GeneralRe: multilanguage application Pin
Member 870181327-Feb-13 16:10
memberMember 870181327-Feb-13 16:10 
Questions/m has to send mail on button click event Pin
Member 870181318-Feb-13 5:24
memberMember 870181318-Feb-13 5:24 
AnswerRe: s/m has to send mail on button click event Pin
Sandeep Mewara18-Feb-13 5:57
mvpSandeep Mewara18-Feb-13 5:57 
GeneralRe: s/m has to send mail on button click event Pin
Member 870181318-Feb-13 6:42
memberMember 870181318-Feb-13 6:42 
GeneralRe: s/m has to send mail on button click event Pin
Sandeep Mewara18-Feb-13 6:49
mvpSandeep Mewara18-Feb-13 6:49 
GeneralRe: s/m has to send mail on button click event Pin
Member 870181318-Feb-13 7:26
memberMember 870181318-Feb-13 7:26 
Questionsending mail on button click event from the s/m Pin
Member 870181318-Feb-13 5:15
memberMember 870181318-Feb-13 5:15 
AnswerRe: sending mail on button click event from the s/m Pin
Sandeep Mewara18-Feb-13 6:00
mvpSandeep Mewara18-Feb-13 6:00 
QuestionUsing Ajax in my project Pin
javeed03518-Feb-13 3:32
memberjaveed03518-Feb-13 3:32 
Questionweb service keep a process open Pin
dcof17-Feb-13 13:12
memberdcof17-Feb-13 13:12 
AnswerRe: web service keep a process open Pin
N a v a n e e t h17-Feb-13 17:15
memberN a v a n e e t h17-Feb-13 17:15 
Questionerror in passing array parameter to a storedprocedure Pin
Member 870181316-Feb-13 16:28
memberMember 870181316-Feb-13 16:28 
AnswerRe: error in passing array parameter to a storedprocedure Pin
Sandeep Mewara16-Feb-13 18:18
mvpSandeep Mewara16-Feb-13 18:18 
GeneralRe: error in passing array parameter to a storedprocedure Pin
Member 870181316-Feb-13 20:45
memberMember 870181316-Feb-13 20:45 
QuestionPublishing asp.net website on cpanel Pin
Arun kumar Gautam15-Feb-13 2:12
memberArun kumar Gautam15-Feb-13 2:12 
AnswerRe: Publishing asp.net website on cpanel Pin
Richard Deeming15-Feb-13 2:38
memberRichard Deeming15-Feb-13 2:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.150624.2 | Last Updated 3 Jul 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid