I can't save a file on my webserver with FileUpload.SaveAs() or with File.WriteAllText(). The folder I save in is CHMOD 666.
My code is this:
File.WriteAllText(MapPath(".") + "\\Ads\\test.jpg", "test");
This code works perfectly in Dev. server.
Best regards, Lasse Espeholt
System.UnauthorizedAccessException: Access to the path *' 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) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode) at System.Web.HttpPostedFile.SaveAs(String filename) at System.Web.UI.WebControls.FileUpload.SaveAs(String filename) at *(Object sender, ListViewInsertEventArgs e)