Troubles with writte permission

Topics: ASP.NET 2.0
Apr 19, 2011 at 8:22 PM

Hello everyone,

 

i followed this tutorial http://www.nyveldt.com/misc/BE13InstallingScreencast.html and everything run smootly (changed password, aprroved comments etc) on my local server. But when i moved blog to my server i can't change my password or aporrove comments.  I'm getting error. So i searched and found that i need to set writte permission on server too like i did on my local server. But since i'm using control panel who doesn't allow me to this(there is no option to do that), i asked support to set permission buit they said this:

 

"Your website executes under unique user account that by default has full control over the website's folder.

So your application can create, open, read, write and delete files and folders inside of your root folder.
There is no need and no way to change this permissions.
If, when running ASP.Net application, you still unable to create file or update it, you have to check your Web.Config file for "<Identity impersonate..." tag and remove it.
The only exception is when the application tries to modify a file or folder in "Application_Start" event of Global.asax file. This is by design that user authenticated only after the Application_Start event. Before the user is authenticated your website runs under an identity of Application Pool which is "Network services". That account doesn't have access to the folder of your website.
To make it work you eather have to move the code that tries to modify files or folders out of the "Application_Start" event of the Global.asax file or inside the event you'll need to impersonate your user by code."

This is error that i'm getting:

Url : http://rgcreports.somee.com/Account/change-password.aspx

Raw Url : /Account/change-password.aspx

Message : Exception of type 'System.Web.HttpUnhandledException' was thrown.

Source : System.Web

StackTrace : at System.Web.UI.Page.HandleError(Exception e)

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

at System.Web.UI.Page.ProcessRequest()

at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)

at System.Web.UI.Page.ProcessRequest(HttpContext context)

at ASP.account_change_password_aspx.ProcessRequest(HttpContext context)

at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

TargetSite : Boolean HandleError(System.Exception)

Message : Access to the path 'd:\DZHosts\LocalUser\SMOKEDorc\www.rgcreports.somee.com\App_Data\users.xml' is denied.

Source : mscorlib

StackTrace : at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

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

at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)

at System.Xml.XmlTextWriter..ctor(String filename, Encoding encoding)

at System.Xml.XmlDocument.Save(String filename)

at BlogEngine.Core.Providers.XmlMembershipProvider.ChangePassword(String username, String oldPassword, String newPassword) in E:\Projects\BlogEngine-HG-10\Source\BlogEngine\BlogEngine.Core\Providers\XmlProvider\XmlMembershipProvider.cs:line 241

at System.Web.Security.MembershipUser.ChangePassword(String oldPassword, String newPassword)

at System.Web.Security.MembershipUser.ChangePassword(String oldPassword, String newPassword, Boolean throwOnError)

at System.Web.UI.WebControls.ChangePassword.AttemptChangePassword()

at System.Web.UI.WebControls.ChangePassword.OnBubbleEvent(Object source, EventArgs e)

at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)

at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)

at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)

at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

TargetSite : Void WinIOError(Int32, System.String)

Coordinator
Apr 19, 2011 at 9:56 PM

You can try this small utility to verify what write access you have on host server.

Apr 20, 2011 at 9:26 PM
Edited Apr 20, 2011 at 9:56 PM

On server on net:

http://rgcreports.somee.com/check/

On my local machine:

http://img192.imageshack.us/i/localr.jpg/

But i dont have access to IIS and they are saying that

"Your website executes under unique user account that by default has full control over the website's folder. So your application can create, open, read, write and delete files and folders inside of your root folder."

 

I'm lil bit stucked, anyway thank you for help. I hope you have something to add that could solve my problem.

 

Greetings!

May 5, 2011 at 11:17 AM
Edited May 5, 2011 at 11:17 AM

Hey, me again

 

I'm still getting this error and there is no way to solve it and i really dont get it why beacuse according to my hosting provider everythings is set properly: ASP.NET version is set to 2.0/3.0/3.5. Aalso if you follow this link http://rgcreports.somee.com/check/ it will show that everything is fine but after writting comment or something else, i get 3 errors. Only the first one is "green".

"Your website executes under unique user account that by default has full control over the website's folder.

So your application can create, open, read, write and delete files and folders inside of your root folder.
There is no need and no way to change this permissions.
If, when running ASP.Net application, you still unable to create file or update it, you have to check your Web.Config file for "<Identity impersonate..." tag and remove it.
The only exception is when the application tries to modify a file or folder in "Application_Start" event of Global.asax file. This is by design that user authenticated only after the Application_Start event. Before the user is authenticated your website runs under an identity of Application Pool which is "Network services". That account doesn't have access to the folder of your website.
To make it work you eather have to move the code that tries to modify files or folders out of the "Application_Start" event of the Global.asax file or inside the event you'll need to impersonate your user by code."