System.io.file.writealltext()在实时主机网站中不起作用 [英] System.io.file.writealltext() is not working in live host website

查看:265
本文介绍了System.io.file.writealltext()在实时主机网站中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

System.IO.File.WriteAllText()在实时主机网站中无效。

本地工作代码:

 DataTable dt = ds.Tables [ 0 ]; 
dt.TableName = event;
string XMLDT = PLWM.Utils.CnvDataTableToXml(dt, false );
System.IO.File.WriteAllText( @ D:\Works\TrueCallWEB\TrueCallWeb\\ \\ _Calendar-Monthly \events.xml,XMLDT);





但在实际实际路径中是http:/ /trucall.in/Calendar-Monthly/events.xml



i将代码编写为

 System.IO .File.WriteAllText( @  Calendar-Monthly / events.xml,XMLDT); 



但它不能正常工作



我尝试过:



System.IO.File.WriteAllText(@Calendar-Monthly / events.xml,XMLDT);

解决方案

< blockquote>你的意思是什么不起作用?你会收到一个错误。我猜这个错误是一个权限问题。大多数托管商不会默认设置您的应用程序,以便它有权写入他们的文件系统。



你必须直接联系他们并要求一些用于存储文件的空间。


System.IO.File.WriteAllText() not working in live host website.
Working code in local:

DataTable dt = ds.Tables[0];
dt.TableName ="event";
string XMLDT = PLWM.Utils.CnvDataTableToXml(dt, false);         
System.IO.File.WriteAllText(@"D:\Works\TrueCallWEB\TrueCallWeb\Calendar-Monthly\events.xml", XMLDT);



but in live actual path is http://trucall.in/Calendar-Monthly/events.xml

i wrote code as

System.IO.File.WriteAllText(@"Calendar-Monthly/events.xml", XMLDT); 


but its not working

What I have tried:

System.IO.File.WriteAllText(@"Calendar-Monthly/events.xml", XMLDT);

解决方案

What do you mean it is not working? You'll get an error. I'm going to guess the error is a permissions issue. Most hosters will not by default set your app up so that it has permissions to write to their file system.

You'll have to contact them directly and ask for some space to store files on.


这篇关于System.io.file.writealltext()在实时主机网站中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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