System.UnauthorizedAccessException: Access to the path 'C:\Inetpub\wwwroot\HealthCard\NewsTextFiles\News.html' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
私は ckeditor を使用しています。サーバーでファイルを編集し、サーバーにファイルを保存します。サーバーでは機能していませんが、ローカルマシンではうまく機能しています。
編集および保存ボタンのコードは次のとおりです。
protected void btnSaveNews_Click(object sender, EventArgs e)
{
string str = Ckeditor.Text;
string str1 = Server.HtmlDecode(str);
//lblText.Text = str2;
FileStream fs = new FileStream(Server.MapPath("~/NewsTextFiles/News.html"), FileMode.Create , FileAccess.Write);
StreamWriter wr = new StreamWriter(fs);
wr.Write(str1);
wr.Dispose();
fs.Dispose();
pnleditor.Visible = false;
upleditor.Update();
upleditor.Visible = false;
}