Download via http ou ftp
23/10/2007
0
Estou tendo dificuldades para fazer download pela minha aplicação... Alguém poderia exemplificar a utilização?
O Framework não retorna Exception específica...
Meu código:
try
{
string strServidor = @´http://192.168.0.135/Download/´;
string strArquivo = ´Arquivo2.txt´;
string Url = strServidor + strArquivo;
HttpWebRequest WebRequest = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse WebResponse = (HttpWebResponse)WebRequest.GetResponse();
StreamReader Str = new StreamReader(WebResponse.GetResponseStream(), Encoding.ASCII);
string Arquivo = Str.ReadToEnd();
StreamWriter Stw = new StreamWriter(´.\\ArquivoCopia.txt´);
Stw.Write(filecontent);
Stw.Flush();
Stw.Close();
Str.Close();
}
catch (Exception er)
{
MessageBox.Show(´Erro!´);
MessageBox.Show(er.ToString());
}
O Framework não retorna Exception específica...
Meu código:
try
{
string strServidor = @´http://192.168.0.135/Download/´;
string strArquivo = ´Arquivo2.txt´;
string Url = strServidor + strArquivo;
HttpWebRequest WebRequest = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse WebResponse = (HttpWebResponse)WebRequest.GetResponse();
StreamReader Str = new StreamReader(WebResponse.GetResponseStream(), Encoding.ASCII);
string Arquivo = Str.ReadToEnd();
StreamWriter Stw = new StreamWriter(´.\\ArquivoCopia.txt´);
Stw.Write(filecontent);
Stw.Flush();
Stw.Close();
Str.Close();
}
catch (Exception er)
{
MessageBox.Show(´Erro!´);
MessageBox.Show(er.ToString());
}
Sergio_r
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)