Andrew
Andrew

Reputation: 25

how to load files on asp.net website

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)));

Upvotes: 1

Views: 1356

Answers (1)

Midnight_Blaze
Midnight_Blaze

Reputation: 501

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.

Upvotes: 1

Related Questions