Y
Y
Yahya2015-04-10 19:22:23
ASP.NET
Yahya, 2015-04-10 19:22:23

Permission denied on C# path?

Good afternoon!
Please tell me how to solve this problem, I'm doing DownloadFile here is the code:
WebClient wc = new WebClient();
wc.DownloadFile(TextBox1.Text, "D:\\"); // or so @"D:\".
in TextBox1 I insert the URL for example (www.test.ru/qwerty.jpg)
An error pops up

Access denied on the path "D:\".
Description: An unhandled exception occurred while executing the current web request. Check the stack trace for more information about this error and the code snippet that caused it.
Exception Details: System.UnauthorizedAccessException: Access denied at path 'D:\'.
ASP.NET is not authorized to access the requested resource. It is recommended that you grant the ASP.NET request identity permissions to this resource. ASP.NET has a base process identity (usually {MACHINE}\ASPNET for IIS 5 or Network Service on IIS 6 and IIS 7, and a configured application pool identity on IIS 7.5)) which is used if the application is not impersonated. If the application is impersonating through a job, the identity will be the anonymous user ID (usually IUSR_MACHINENAME) or the authenticated request user ID.
To grant ASP.NET write access to a file, right-click the file in the Explorer window, select Properties, then the Security tab. Select "Add" to add the corresponding user or group. Highlight the ASP.NET account and check the boxes for the required permissions.
Help please who faced such a problem, and even did everything with administrator rights

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yahya, 2015-04-11
@gamma06

Question removed. If anyone is interested in this solution. In addition to the path, you must specify the name and type of the file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question