如何在iis服务器上运行的asp.net中的linkbutton上打开excel文件 [英] how to open excel file on linkbutton in asp.net running on iis server
本文介绍了如何在iis服务器上运行的asp.net中的linkbutton上打开excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友
任何人都可以告诉我如何在iis服务器上的asp.net链接按钮中打开excel文件.
实际上,当我们单击linkbutton时,我创建了一个项目excel文件将打开,我在linkbutton中编写了代码
hello friends
anyone can tell me how open excel file in asp.net linkbutton on iis server.
actually i made a project when we click linkbutton excel file will be open i write a coding in linkbutton
System.Diagonostics.Process.Start("excelfile Path");
但是,当我的网站在IIS服务器上运行时,如果我应该这样做将无法正常工作.请给我适当的步骤,仅在linkbutton上打开excel文件..
发送正确的编码...
But when my web site run on IIS server it will not work wht should i do.pls give me the proper step to open excel file on linkbutton only..
send a proper coding...
推荐答案
您应该执行一些谷歌搜索来代替询问正确的代码.如果您从侧面进行一些研发,如果失败了,那可以更好的在代码中寻求帮助.
You should do some googling in place of asking PROPER CODE. Better if you do some R&D from your side and if you are fail then you can ask for help within your code.
System.Diagonostics.Process.Start("excelfile Path");
这不适用于ASP.NET
尝试以下代码.
this will not work for ASP.NET
Try following code.
Response.Writefile(filePath);//Relative file path
Response.ContentType = "application/x-excel";
Response.AddHeader("content-disposition", "inline; filename=\"" + YourSuggestedFileName + "\"");
这篇关于如何在iis服务器上运行的asp.net中的linkbutton上打开excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文