R
Ryan
I have the following code that reads a file; how do I display it on the
screen or display a dialog box to save or view file?
private void LoadFile(object sender, EventArgs e)
{
try
{
MemoryStream StreamedExcelFile;
Uri uri = new
Uri("http://adoptaboxerrescue.net/protest/MyExcelFile.xls");
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(uri);
WebRequest myReq = WebRequest.Create(uri);
string sOutFile = @"c:\temp\MyFile.xls";
WebResponse wr = myReq.GetResponse();
wr.Headers.Add("Conteny-Disposition", "attachment; filename
= " + sOutFile);
Stream receiveStream = wr.GetResponseStream();
StreamReader reader = new
StreamReader(wr.GetResponseStream(), Encoding.ASCII);
string content = reader.ReadToEnd();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK);
}
}
screen or display a dialog box to save or view file?
private void LoadFile(object sender, EventArgs e)
{
try
{
MemoryStream StreamedExcelFile;
Uri uri = new
Uri("http://adoptaboxerrescue.net/protest/MyExcelFile.xls");
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(uri);
WebRequest myReq = WebRequest.Create(uri);
string sOutFile = @"c:\temp\MyFile.xls";
WebResponse wr = myReq.GetResponse();
wr.Headers.Add("Conteny-Disposition", "attachment; filename
= " + sOutFile);
Stream receiveStream = wr.GetResponseStream();
StreamReader reader = new
StreamReader(wr.GetResponseStream(), Encoding.ASCII);
string content = reader.ReadToEnd();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK);
}
}