1

I have an ASP.NET web site. The site has a button that allows you to load your photo on the website and it works without any problems on my local computer. But on server when I want to upload an image, I catch an exception. This is the exception that I catch:

Access to the path 'C:\inetpub\vhosts\u0270481.plsk.regruhosting.ru\httpdocs\ps-plus.pro\UsersIcons\259b60ca-16de-4168-8b45-900f7078bcea.png' is denied.

There is a code I use:

FileUpload1.SaveAs(Server.MapPath(String.Format("UsersIcons/{0}", userIcoName)));
2
  • It looks like the UserIcons folder only has READ access on the server. You need to change it to READ/WRITE Commented Dec 30, 2016 at 20:57
  • Thank you very much! All works without errors! Commented Dec 30, 2016 at 21:20

1 Answer 1

1

The asp.net website works with a Windows given user (a user account, not an administrator, likely) so, when that user tries to access the server C path/or whatever path you set it, and that drive does not allow that user to copy from that path, you'll get that exception.

You can add permission to that user over your file and then it'd work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.