Forum Moderators: open

Message Too Old, No Replies

Access to the path [path] is denied

Cannot programmatically create new folders

         

Soporose

8:00 am on Apr 5, 2010 (gmt 0)

10+ Year Member



Hi all -- I hope this is an appropriate place for this topic.

I'll start off by trying to keep it as simple as possible, but please ask if more information required.

BACKGROUND:

* I am a reseller for a major host, and as such I do not have direct access to the web server configuration, though the host technicians are fairly compliant with requests.

* Web server is Windows Server 2008/IIS7

* I use the DotNetPanel API to create new accounts (based on forms completed by a new customer) under my reseller account. I provide the DotNetPanel API with my reseller account login credentials, and this part works fine. New accounts are created just as required.

* Following the creation of the new account I then need to programmatically add a few folders to the new account. E.g. /images. This is where my problem starts.

MY .NET CODE (VB):

Here is the relevant snippet of my code:

Try
IO.Directory.CreateDirectory(NewFolderPath)
Catch ex As Exception
Response.Write("Error Message = " & ex.Message & "<br>")
End Try


THE PROBLEM:

The result is always:

Access to the path 'C:\first-part-of-path-here\wwwroot\images\' is denied.

I then tried modifying the local web.config file with the addition of the following:

<system.web>
<identity impersonate="true" userName="Reseller-Username" password="Password" />
</system.web>


But then I get the following:

---------------------
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'Logon failure: unknown user name or bad password.

Source Error:

Line 35: <system.web>
Line 36:
Line 37: <identity impersonate="true" userName="Reseller-Username" password="Password" />
Line 38:
Line 39: </system.web>

Source File: C:\blah\blah\blah\web.config Line: 37
---------------------


If it is simply a matter of passing the right credentials in the application, it is not clear to me just what credentials are being requested and how they should be passed.

Since obviously I can create folders manually using DotNetPanel's File Manager or any FTP client, it seems to me I should be able to do the same thing programmatically.

Thank you for your assistance.

marcel

6:35 am on Apr 6, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think you need to add the Computer or Domain Name to your Identity Login, ie:

<identity impersonate="true" userName="ComputerName\Reseller-Username" password="Password" />