| 发表于:2007-05-30 19:06:373楼 得分:0 |
vb.net开发web程序发布后,在客户端(客户机访问服务器)不能打开服务器端形成的excel文件,后来用了response.writefile()方法把文件下载到客户端后再打开,在普通页面可以实现。但是同样方法在模式窗口下不能打开,没有反应。(有可能是模式窗口焦点不能失去的问题) 例如a为主画面,有个按钮从数据库读取数据,写到excel中,这是在服务器上完成的,客户端访问时用response.writefile()下到本地,再打开,可以实现。 a中打开b窗口,是用showdialog模式方法打开,同样有个按钮一样功能,同样方法却不能实现,不知道是什么原因 system.io.fileinfo myfileinfo = new fileinfo(_fullpath); _response.addheader( "content-disposition ", "attachment; filename= " + httputility.urlencode(myfileinfo.name)); _response.addheader( "content-length ", myfileinfo.length.tostring()); _response.contenttype = "application/octet-stream "; _response.writefile(myfileinfo.fullname ); | | |
|