Jas*_*n94 7 c# asp.net asp.net-mvc-3
在我的bin文件中,我设置了som测试数据,我希望我的应用程序能够访问存储在其中的日志文件bin/log/log00001.txt
.
但是,在我的crontroller中,当我尝试在以下路径上使用TextReader时,它会转到其他地方: new StreamReader("log/log00001.txt")
我如何阅读与项目相关的内容?
che*_*d23 12
尝试使用
StreamReader reader = new StreamReader(Server.MapPath("~/bin/log/log00001.txt"));
Run Code Online (Sandbox Code Playgroud)
HttpContext.Current.Server.MapPath("~/some/path/relative/to/your/web/app")
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4633 次 |
最近记录: |