简体   繁体   中英

Access to the path is denied or How Do I Add Impersonation for a rackspace site?

Writing to an XML file in the website and facing 'Access to the path xxx is denied' error on rackspace cloud hosting?

The answer has to be impersonation but what is the secret sauce?

This is Q&A style. See my answer below.

UPDATE: Setting the security on the folder while while logged in as admin with my FTP client to "Other" worked without impersonation. Allowing updates through the web app.

Write to a file in the website requires impersonation. In this environment I was unable to get impersonation to work from code behind so the only option was a web.config solution.

The user is the FTP user you have set up. You can and should set up an FTP user just for this and restrict its rights for security. The real key is to know if you are an ORD user or a DFW user. These are the current rackspace data centers. Below is an impersonation example for the ord data center.

<configuration>
  <system.web>
    <identity impersonate="true" userName="ord\USERNAME" password="PASSWORD" />
  </system.web>
</configuration>

In order to discover what data center your site is out of you could try one then the other or you could log into your control panel and look at the testlink for your site.

Login to manage.rackspacecloud.com > Hosting > Cloud sites > [your site] > General Settings > Viewing and Editing > Testing URL

If your link contains "ord" in it then your account is in ord else your account is in dfw.

Once you have made this config change make sure that you rebuild the application from your control panel.

The rackspace site says the following but I have not found this to be true:

You **must** use the username which is configured to be the primary FTP 
         account for the cloud site you are working with. If the site was created
         under your main account, this will be your main control panel login 
         credentials. If the site was created under a client, please use the 
         client's main account credentials. When in doubt, you can always click 
         the security tab for a cloud site to confirm the primary ftp account.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM