This project is read-only.

Access Denied

Topics: Developer Forum, Project Management Forum, User Forum
Sep 27, 2007 at 11:41 PM
Received the following error. Any ideas on how to fix this?

Thanks

BTW, Great Site!




Access to the path 'd:\hosting\dlrjr\App_Data\Users.config' is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path 'd:\hosting\dlrjr\App_Data\Users.config' is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Source Error:


Line 505: lock (_path)
Line 506: {
Line 507: users.WriteXml(path, XmlWriteMode.WriteSchema);
Line 508: }
Line 509: }


Source File: d:\hosting\dlrjr\App_Code\Providers\CustomXmlMembershipProvider.cs Line: 507

Stack Trace:


UnauthorizedAccessException: Access to the path 'd:\hosting\dlrjr\App_Data\Users.config' is denied.
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +1971539
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +998
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +114
System.Xml.XmlTextWriter..ctor(String filename, Encoding encoding) +33
System.Data.DataTable.WriteXml(String fileName, XmlWriteMode mode, Boolean writeHierarchy) +76
System.Data.DataTable.WriteXml(String fileName, XmlWriteMode mode) +10
MyWebPagesStarterKit.Providers.CustomXmlMembershipProvider.save() in d:\hosting\dlrjr\App_Code\Providers\CustomXmlMembershipProvider.cs:507
MyWebPagesStarterKit.Providers.CustomXmlMembershipProvider.ValidateUser(String username, String password) in d:\hosting\dlrjr\App_Code\Providers\CustomXmlMembershipProvider.cs:468
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160
System.Web.UI.WebControls.Login.AttemptLogin() +105
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102




--------------------------------------------------------------------------------
Sep 28, 2007 at 8:05 AM
Problem is that the App_Data folder has not got the appropriate rights to add/delete files.
In case you use shared hosting, in most cases you can set this up (per folder) in the admin panel.
Sep 28, 2007 at 12:18 PM
I use godaddy to host and I dont where to go to change permissions. Can you provide any more details and/ or help suggestions?

Thanks for all,
dpr00
Oct 1, 2007 at 8:40 AM
I don't know godaddy. Perhaps you can as them to do that for you when their control panel doesn't have the abbility.
Any way; the app_data folder (and all it's sub-folders) have to have full-control for the ASPNET user on the webserver. Full control means READ, WRITE and DELETE.
There is more documentation available on this subject on the MWPSK website. I ran into this issue also when I started using this it ;-)
Hope this helps.


dpr00 wrote:
I use godaddy to host and I dont where to go to change permissions. Can you provide any more details and/ or help suggestions?

Thanks for all,
dpr00

Jul 30, 2008 at 4:03 AM
I've just moved over to goDaddy and of course faced the same permissions issue, once I found out how to change the permission to read & write, it still doesn't work. One of the warning notes that goDaddy mentioned when setting the read & write permissions was that the supporting code would need to be set to annonymous, I'm not sure where that is, I presume in the config file. Anyway, this is what goDaddy sent me to change permissions:

To modify Windows permissions using the File Manager:

1. Log in to your Account Manager.
2. In the My Products section, select Hosting.
3. Next to the hosting account you want to modify, click Manage Account.
4. In the Content section, click File Manager.
5. Select the directory or directories for which you'd like to set permissions.
6. Click the Permissions icon.
7. Select the permissions for the selected files

The interesting thing about the permissions is that there are 4 settings you can actually select, which goDaddy describe as:

Read:
Selecting "Read" enables anonymous users to view files in the directory through a Web browser.
Deselecting "Read" presents users of your Web site that reference files in the directory with a security challenge. To view the files, users must authenticate into the hosting account by entering the FTP user name and password.
NOTE: You must select the "Anonymous Access" setting in the IIS Settings for a page in the directory to be viewable through a Web browser.

Write:
Selecting "Write" enables anonymous users to use your site's applications to modify the contents of a directory. Select "Write" only if your site's applications create files or write to files in the directory.

Inherit:
Selecting "Inherit" removes the explicit "Read" and "Write" permissions on a directory, so it inherits its parent directory's permissions. When a directory inherits permissions from its parent, the directory's permissions are dynamically updated when the parent's permissions are updated. Deselecting "Inherit" applies the explicit "Read" and "Write" permissions to the directory. When a directory does not inherit permissions from its parent, the directory's permissions are unaffected by updates to the parent's permissions.

Reset all children to inherit:
Selecting "Reset all children to inherit" causes the "Inherit" setting to be cascaded to all of the subdirectories below the directory. This condition has the affect of removing any explicit permissions that may have been set.

My question is, do you just need to set read & write permission only and leave the other two Inherit permissions off, and do you need to set the main folder 'App_Code'  as well as the sub-folders underneath (Controls, FCKEditor, Providers, Sections) as well?

Has anyone successfully got the starter kit working on goDaddy, I still get the same error message as everyone else, which I have shorthenen below, thanks for any help :-)

Access to the path 'd:\hosting\tailwags\App_Data\Users.config' is denied.
Line 511:            lock (_path)
Line 512:            {
Line 513:                _users.WriteXml(_path, XmlWriteMode.WriteSchema);
Line 514:            }
Line 515:        }
Source File: d:\hosting\tailwags\App_Code\Providers\CustomXmlMembershipProvider.cs    Line: 513

Stack Trace:

[UnauthorizedAccessException: Access to the path 'd:\hosting\tailwags\App_Data\Users.config' is denied.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +651
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +1038
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +114
   System.Xml.XmlTextWriter..ctor(String filename, Encoding encoding) +38
   System.Data.DataTable.WriteXml(String fileName, XmlWriteMode mode, Boolean writeHierarchy) +76
   System.Data.DataTable.WriteXml(String fileName, XmlWriteMode mode) +10
   MyWebPagesStarterKit.Providers.CustomXmlMembershipProvider.save() in d:\hosting\tailwags\App_Code\Providers\CustomXmlMembershipProvider.cs:513
   MyWebPagesStarterKit.Providers.CustomXmlMembershipProvider.ValidateUser(String username, String password) in d:\hosting\tailwags\App_Code\Providers\CustomXmlMembershipProvider.cs:474
   System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160
   System.Web.UI.WebControls.Login.AttemptLogin() +105
   System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
Jul 30, 2008 at 4:35 AM
Okay, I have resolved my issue and it was done this way. The error above refers to the 'App_Code' folder, so I set the permissions in goDaddy as described above on that folder, however I actually needed to set the permissions on the 'App_Data' folder for it to work. I assume many have made the same simple mistake, so I am writing the fix here. Currently I have both of those folders set to read & write permissions.
Jul 30, 2008 at 4:27 PM
You may want to remove 'write' permissions from the app_code folder - it isn't needed and could be a security issue.
Jul 31, 2008 at 5:30 AM
Good thinking Carl, I'll do that :-) You aren't an Australian by any chance are you, I know a Carl Carlson from Newcastle in NSW.
Jul 31, 2008 at 3:48 PM
Nope, sorry.  It's actually a Simpsons reference.
Aug 1, 2008 at 5:34 AM
Right, I see, perhaps I need a little more culture in my life :-) Cheers
Jan 5, 2009 at 11:21 PM
Hi Tailwag,

I am using Godaddy hosting and I could not find the 'permissions icon' in the file manager section.  Am I missing something, or did they change the site?

Thanks!

Jude
Jan 6, 2009 at 3:04 AM
Hi mate, Okay I'll write it again differently, you should print out what I write and follow my instructions exactly, they haven't changed it and it is easy once you find it the first time, try this:

1. Logon to your account and click on Hosting
2. Click on Manage Account of the domain you wish to work with if you have more than one.
3. Click on the large icon which has 'Your Files - Manage site content' written on it.
4. Click on the folder in the list (check the box on the left), then the Permissions Box (above your folder listing) becomes active, click it and a new section drops down.
5. Check the permission level you desire then click Ok
6. Take your check mark out of the folder listing to give you back greater security

If you do all that correctly you will see an eye icon on the right hand side ajacent to the folder you selected.

If you can't do it this time, throw yourself in front of a train :-)

Regards
Ron
Jan 6, 2009 at 5:20 PM
Hi Ron,

I was getting ready to throw myself in front of a train, but then I realized I was using the free hosting package that they give you when you buy a domain.  I looked at one of my accounts that has purchased hosting
and the permissions icon was there.  Good thing the blue line was running late.

Thanks,

Jude
Jan 6, 2009 at 7:20 PM
Hi Ron,

One other thing - you have to have your FrontPage extensions turned off, or the permissions button does not come up. 

Cheers,

Jude
Jan 7, 2009 at 3:17 AM
Oh, do they still make Frontpage?
Jan 7, 2009 at 10:06 PM
Not that I know of - but you can use the extensions with web developer and sharepoint designer...
Jan 7, 2009 at 11:36 PM
I was only joking about Frontpage, I used it once by mistake, which of course was my greatest error :-(