请大家帮忙,使用模板的问题

weasea 2010-05-11 04:29:03
vs2008
本机程序在d:\test\aspTest
excel模板也放在 d:\test\aspTest\template目录下

string tmpRootDir = Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString());//
tmpRootDir = tmpRootDir + @"\Template\";
string templetFile =tmpRootDir+@"Templet.xls";


然后发布网站,放在服务器上,经过测试,访问excel模板,就出现问题。
我哪儿做错了,谢谢
...全文
86 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
mngzilin 2010-05-13
  • 打赏
  • 举报
回复
你这是乱写吧:
=====================================
Server.MapPath("相对路径");
获取网站根目录:
AppDomain.CurrentDomain.BaseDirectory
qiqishardgel 2010-05-13
  • 打赏
  • 举报
回复
友情帮顶!
asdfa23rdadsdfa 2010-05-12
  • 打赏
  • 举报
回复

每天回帖即可获得10分可用分!小技巧:教您如何更快获得可用分
weasea 2010-05-12
  • 打赏
  • 举报
回复
发布网站,放在服务器上,经过测试,访问excel模板。

string tmpRootDir = Server.MapPath(@"d:\test\aspTest\template\Templet.xls");
这样的访问方法会有问题的吧
gongsun 2010-05-12
  • 打赏
  • 举报
回复
取路径出了问题

-------------

string tmpRootDir = Server.MapPath("Templet.xls");

直接放在你操作页的 同目录下...

-----------

string tmpRootDir = Server.MapPath(@"d:\test\aspTest\template\Templet.xls");

写死了 在看看。
lilin8905 2010-05-12
  • 打赏
  • 举报
回复
是不是没有权限
weasea 2010-05-12
  • 打赏
  • 举报
回复
up.....
frankbooth 2010-05-11
  • 打赏
  • 举报
回复
先顶起再说……
weasea 2010-05-11
  • 打赏
  • 举报
回复
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>

---------------------------------------
出错信息

62,047

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧