Click here to Skip to main content
15,890,995 members
Home / Discussions / C#
   

C#

 
AnswerRe: Help is needed (Urgent) Pin
EliottA7-Oct-09 9:07
EliottA7-Oct-09 9:07 
QuestionWhat's special with message box? Pin
teknolog1237-Oct-09 6:56
teknolog1237-Oct-09 6:56 
AnswerRe: What's special with message box? Pin
PIEBALDconsult7-Oct-09 7:27
mvePIEBALDconsult7-Oct-09 7:27 
GeneralRe: What's special with message box? [modified] Pin
teknolog1237-Oct-09 7:37
teknolog1237-Oct-09 7:37 
GeneralRe: What's special with message box? Pin
LimitedAtonement7-Oct-09 7:42
LimitedAtonement7-Oct-09 7:42 
GeneralRe: What's special with message box? Pin
teknolog1237-Oct-09 8:09
teknolog1237-Oct-09 8:09 
GeneralRe: What's special with message box? Pin
PIEBALDconsult7-Oct-09 7:42
mvePIEBALDconsult7-Oct-09 7:42 
QuestionAnother method safer than StreamWriter and how can I save the file on another server (asp.net c sharp) Pin
aspkiddy7-Oct-09 6:32
aspkiddy7-Oct-09 6:32 
I have a form: when the user fills a form, the application takes this information and creates a data file (.csv) and put it (data file) on the server in a directory (name of this directory is [information]) where the web site is located.

using (System.IO.StreamWriter SW = new System.IO.StreamWriter(Server.MapPath("save/information/Data_" + strDate + ".csv")))

{
 SW.WriteLine(s.FirstName + ";" + s.LastName + ";" + s.Address1 + ";");
 SW.Close();
} 


After, I changed the path for save the file, in a different server than the Web server

StreamWriter SW = new StreamWriter(@"\\111.222.1.00\c$\Inetpub\wwwroot\site_toto\ save\information\Data_" + strDate + ".csv");


It must disable the firewall on server so that it works. I can’t it.

So instead of filing the file with system Windows, I'd like to put with FTP protocole on another place, but I do not know how I can do.

I have a class! How can I integrate it?

Is that correct if I do like that ? :Confused | :confused:


using (FTP ftplib = new FTP(MapPath ("Data_" + strDate + ".csv")));

try 
{
    ftplib.Connect("ftp.toto.com", 
                   "tata", 
                   "pata");
    ftplib.ChangeDir("information/");
}
catch(Exception ex)
{    
    Console.WriteLine(s.FirstName + ";" + s.LastName + ";" + s.Address1 + ";");
}

try
{ 
    int perc =  0;
    

    ftplib.OpenDownload("Data_" + strDate + ".csv", true);
    while(ftplib.DoDownload() > 0) 
    { 
        perc = (int)((ftplib.BytesTotal * 100)  / ftplib.FileSize); 
        Console.Write("\rDownloading: {0}/{1} {2}%", 
          ftplib.BytesTotal, ftplib.FileSize, perc);
        Console.Out.Flush();
    }
    Console.WriteLine("");
}
catch(Exception ex) 
{ 
    Console.WriteLine("");
    Console.WriteLine(ex.Message);
}

Confused | :confused: What do you think of my integration code that you see above? is that this can work or I'm completely wrong Confused | :confused:
QuestionCode Readability Poll Pin
LimitedAtonement7-Oct-09 5:57
LimitedAtonement7-Oct-09 5:57 
AnswerRe: Code Readability Poll Pin
Kevin Marois7-Oct-09 6:34
professionalKevin Marois7-Oct-09 6:34 
GeneralRe: Code Readability Poll Pin
N a v a n e e t h7-Oct-09 7:38
N a v a n e e t h7-Oct-09 7:38 
GeneralRe: Code Readability Poll Pin
PIEBALDconsult7-Oct-09 8:22
mvePIEBALDconsult7-Oct-09 8:22 
GeneralRe: Code Readability Poll Pin
Gideon Engelberth7-Oct-09 9:14
Gideon Engelberth7-Oct-09 9:14 
GeneralRe: Code Readability Poll Pin
PIEBALDconsult7-Oct-09 13:49
mvePIEBALDconsult7-Oct-09 13:49 
AnswerRe: Code Readability Poll Pin
Luc Pattyn7-Oct-09 6:40
sitebuilderLuc Pattyn7-Oct-09 6:40 
GeneralRe: Code Readability Poll Pin
Ennis Ray Lynch, Jr.7-Oct-09 8:59
Ennis Ray Lynch, Jr.7-Oct-09 8:59 
GeneralRe: Code Readability Poll Pin
Luc Pattyn7-Oct-09 9:14
sitebuilderLuc Pattyn7-Oct-09 9:14 
GeneralRe: Code Readability Poll Pin
PIEBALDconsult7-Oct-09 12:58
mvePIEBALDconsult7-Oct-09 12:58 
AnswerRe: Code Readability Poll Pin
N a v a n e e t h7-Oct-09 6:42
N a v a n e e t h7-Oct-09 6:42 
GeneralRe: Code Readability Poll Pin
PIEBALDconsult7-Oct-09 7:32
mvePIEBALDconsult7-Oct-09 7:32 
GeneralRe: Code Readability Poll Pin
N a v a n e e t h7-Oct-09 7:42
N a v a n e e t h7-Oct-09 7:42 
GeneralRe: Code Readability Poll Pin
DaveyM697-Oct-09 9:08
professionalDaveyM697-Oct-09 9:08 
GeneralRe: Code Readability Poll Pin
LimitedAtonement7-Oct-09 10:02
LimitedAtonement7-Oct-09 10:02 
GeneralRe: Code Readability Poll [modified] Pin
DaveyM697-Oct-09 11:12
professionalDaveyM697-Oct-09 11:12 
AnswerRe: Code Readability Poll Pin
Not Active7-Oct-09 6:44
mentorNot Active7-Oct-09 6:44 

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

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