简体   繁体   English

在线写入文本文件,Web路径是什么样的?

[英]Write to text file online, What does the web path look like?

I'm trying to write a log function for my website and am having difficulty writing the logs to the text file. 我试着写我的网站日志功能时遇到的困难写日志到文本文件。 I am using log4net. 我正在使用log4net。

I think my problem is with the path. 我认为我的问题在于路径。 The logger works on my local host when the text file is stored on my PC but the code won't work online. 当文本文件存储在我的PC上时,记录器可在我的本地主机上运行,​​但代码无法在线运行。

The text file I'm trying to write to is called currentLog.txt , as you can see in the picture below. 我尝试写入的文本文件称为currentLog.txt ,如下图所示。

在此处输入图片说明

In my web.config I have the option to insert the path in witch to find the text file. 在我的web.config中,我可以选择在女巫中插入路径以查找文本文件。 I can't seem to find the correct way to insert the path. 我似乎找不到正确的方法来插入路径。

<file value="../../Logs/CurrentLog.txt"/>
<file value="..\\Logs\\CurrentLog.txt"/>
<file value="~/Logs/CurrentLog.txt"/>
<file value="/formvlgx/formvalue.co.za/wwwroot/Logs/CurrentLog.txt"/>
<file value="http://formvalue.co.za/wwwroot/Logs/CurrentLog.txt"/>

Could someone please show me the correct way to insert a path for a live site? 有人可以告诉我为在线站点插入路径的正确方法吗?

your value should be like this. 您的价值应该是这样的。 value="../Logs/CurrentLog.txt" value =“ ../ Logs / CurrentLog.txt”

Please use Server.MapPath to get the file location. 请使用Server.MapPath来获取文件位置。

Web path would be: http://formvalue.co.za/Logs/CurrentLog.txt Web路径为: http : //formvalue.co.za/Logs/CurrentLog.txt

Absolute path on server: /formvlgx/formvalue.co.za/wwwroot/Logs/CurrentLog.txt 服务器上的绝对路径:/formvlgx/formvalue.co.za/wwwroot/Logs/CurrentLog.txt

Note: Be careful with making logs accessible to the public. 注意:小心使日志对公众开放。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM