0

Asp.net Web サイトにファイルをアップロードしようとしています。問題は、Visual Studio で開発中に Web サイトのソリューションに含めたフォルダーの 1 つで、Web サーバー自体にファイルを保存することです。

そのフォルダへのアクセス権を取得できません。ユーザーがどのようにしてそのフォルダにアクセスできるのだろうかと思います。ファイルをフォルダに保存し、他のユーザーがダウンロードできるようにしたい。

FileUpload1.PostedFile.SaveAs(Server.MapPath("~/folder"));

私が得るエラーは次のとおりです。

Access to the path 'C:_________________________________is denied
System.UnauthorizedAccessException

どんな提案でも大歓迎です。

ありがとうございました

シャリーン

4

1 に答える 1

0

You should grant read and write permissions to the ASPNET / NETWORK SERVICE user for the specified folder. If for some reason you stuck on this, you can just for test set write permissions to the everyone user to verify that the problem is resolved. After that remove the permissions and test again with the NETWORK SERVICE account.

Check this MSDN article for more information http://msdn.microsoft.com/en-us/library/ff647402.aspx.

于 2014-06-27T05:52:35.887 に答える