I know this question was asked many times here, but I can't find a solution to my problem. I'm trying to save image to the folder in .net c# but get this exception:
Access to the path 'C:\inetpub\wwwroot\mysite\images\savehere' is denied.The error occured at mscorlib because 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, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
I gave full control to this folder (savehere) to network service
and iis_iusrs
, even gave full control to everyone
but still getting this exception.
I tried to give access via explorer and via IIS manager, still no luck
I'm doing it on Windows server 2008 R2 and IIS 7.5, Who do I need to give access?
Thanks
please add IIS_IUSERS full control permission to your folder. you find this option from security tab in folder properties.
I Solved with this setting:
My problem was something like that:
but instead of using path I should use File.FullName... I don't know if it's going to help anyone else, just passing my own experience with this erro given!
What Identity is your Application Pool for the Web application running as, to troubleshoot, try creating a new App Pool with say Network Service as its identity and make your web application use that new App Pool you created and see if the error persists.
I got this problem when I try to save the file without set the file name.
Old Code
Working Code
I created a virtual dir with full permission and added the ffmpeg source and video files there, so finally it made sense as it can be acess by anyone.