下载服务器端的Excel路径不对问题?请高手指点
我写了一段代码.在自己本机的ASP.NET程序里运行就可以下载服务器端指定目录下的Excel,可是我只把程序一发布到服务器,在通过客户端运行程序就打不开了.说路径不对.请高手指点,以下是我相应代码:
Excel.Application app;
Excel.Workbook workBook;
Excel.Worksheet workSheet;
app = new Excel.ApplicationClass();
app.Visible = true;
workBook = app.Workbooks.Open( "../Film/excelfile20072829092836.xls ",
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
workSheet = (Excel.Worksheet)workBook.Sheets.get_Item(1);
以上这部分我曾今试过用绝对路径替换 "../Film/excelfile20072829092836.xls ",
"http://10.17.15.13/Film/excelfile20072829092836.xls "
可是用绝对路径还是不行。
[解决办法]
Page.RegisterStartupScript( "open ", " <script language= 'JavaScript '> window.open( 'http://.../Film/excelfile " + name + " '); </script> ");