运行在线网站时,XML文件无法读取 [英] XML File not reading while runing Online website

查看:88
本文介绍了运行在线网站时,XML文件无法读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.net项目,它从XML文件中提取数据并显示在网页上。



我已将XML文件保存在C盘中

当我在本地主机上运行它...它成功运行.... !!!



当我在我的网站上运行这个时... ..然后我显示错误... 找不到XML文件路径C:\表单数据



请告诉我.. ..怎么解决这个..





-Rectus

I have one ASP.net Project which extracts data from XML file and displays on webpage.

I have saved XML File in C drive
When I run this on Local host ...It Runs Successfully....!!!

While when I run this Online on my website ....then I shows error ...that could not find XML file path C:\ Form data

please tell me ....How to solve this ..


-Rectus

推荐答案

Web应用程序正在沙盒环境中执行,可防止损坏主机系统。只有将文件放在为站点配置的根目录下时,才能访问它们。对于文件在主机文件系统中的位置,可以调用方法 MapPath

http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath.aspx [ ^ ]。



而且,来吧,你的服务器主机可能也不知道驱动器C:是什么:-)。



-SA
Web applications are being executed in sandboxed environment which prevents damaging the host systems. Your files can only be accessed if they are placed under the root directory configured for your site. For the location of the file in your host file system, you can call the method MapPath:
http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath.aspx[^].

And, come on, you server host may have no the idea even on what the "drive C:" is :-).

—SA


这篇关于运行在线网站时,XML文件无法读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆