Bug in Logon after several failed attempts....

Topics: Developer Forum, User Forum
May 24, 2008 at 7:07 PM
Hi all

I'm getting this error message after several failed attempts to logon .. . .. any ideas what's wrong ?

Many thanks....

Access to the path 'D:\websites\parking\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:\websites\parking\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 511:            lock (_path)
Line 512:            {
Line 513: _users.WriteXml(_path, XmlWriteMode.WriteSchema);Line 514:            }
Line 515:        }

Source File: d:\websites\parking\App_Code\Providers\CustomXmlMembershipProvider.cs    Line: 513

Stack Trace:

[UnauthorizedAccessException: Access to the path 'D:\websites\parking\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:\websites\parking\App_Code\Providers\CustomXmlMembershipProvider.cs:513
   MyWebPagesStarterKit.Providers.CustomXmlMembershipProvider.ValidateUser(String username, String password) in d:\websites\parking\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


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
May 27, 2008 at 3:43 PM
Hi!

Your problem is not the login, but write access to the App_Data directory which has special rights. The error occurs when mwpsk tries to write your logon attempt to the user.config.

You need to grant write access and further rights to this directory App_Data. I reccomend you to ask your host provider to grant this rights, since App_Data is a special asp.net-directory

Take a look here: http://www.codeplex.com/MyWebPagesStarterKit/Thread/View.aspx?ThreadId=27823

A.