locked
Exception Details: System.Security.SecurityException: Requested registry access is not allowed. RRS feed

  • Question

  • User680445521 posted

    Hello,

      I've spent all afternoon trying to implement a secure login for a new project but I'm stuck at this error:

     

    Server Error in '/' Application.
    Security Exception
    Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
    
    Exception Details: System.Security.SecurityException: Requested registry access is not allowed.
    
    Source Error:
    
    The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
    
    1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
    
      <%@ Page Language="C#" Debug="true" %>
    
    or:
    
    2) Add the following section to the configuration file of your application:
    
    <configuration>
       <system.web>
           <compilation debug="true"/>
       </system.web>
    </configuration>
    
    Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
    
    Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.
    
    Stack Trace:
    
    [SecurityException: Requested registry access is not allowed.]
       System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) +51
       Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +7464345
       System.Diagnostics.EventLog.GetLogRegKey(String currentMachineName, Boolean writable) +102
       System.Diagnostics.EventLog.ModifyOverflowPolicy(OverflowAction action, Int32 retentionDays) +183
       Simple.Providers.MySQL.MysqlMembershipProvider.WriteToEventLog(Exception e, String action) +64
       Simple.Providers.MySQL.MysqlMembershipProvider.GetUserNameByEmail(String email) +315
       Simple.Providers.MySQL.MysqlMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +126
       System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +318
       System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +103
       System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +417
       System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +161
       System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +19
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
       System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +118
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +169
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6223
       System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +247
       System.Web.UI.Page.ProcessRequest() +79
       System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +23
       System.Web.UI.Page.ProcessRequest(HttpContext context) +110
       ASP.default_aspx.ProcessRequest(HttpContext context) +37
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +406
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +76
    
    
    Version Information: Microsoft .NET Framework Version:2.0.50727.3620; ASP.NET Version:2.0.50727.3618 

     

    This is on a hosted servver so I don't have access to IIS, can anyone help? The error can be accessed here: www.concard.co.uk

     

    Thanks

    Wednesday, April 27, 2011 12:11 PM

Answers

  • User915387828 posted

    Hi LWCARAB,

    The account that your ASP.NET code is running as needs the rights to do whatever you're trying to do.

    You should give enough permission to the asp.net accout(IIS_Users).

    Please check the following link:

    http://support.microsoft.com/kb/329291

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 2, 2011 4:07 AM

All replies

  • User-1469158370 posted

    Are you trying to access registry in your code base?

     

    Shared hosting never allows that. In shared hosting, you code will run under low trust, hence any kind of registry access will be disallowed

    Thursday, April 28, 2011 12:09 PM
  • User-1469158370 posted

    I can see that you are trying to log in event log. Don't do that. Use database logging or write everything in a file. That's the only way to go.

    Thursday, April 28, 2011 12:10 PM
  • User915387828 posted

    Hi LWCARAB,

    The account that your ASP.NET code is running as needs the rights to do whatever you're trying to do.

    You should give enough permission to the asp.net accout(IIS_Users).

    Please check the following link:

    http://support.microsoft.com/kb/329291

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 2, 2011 4:07 AM
  • User915387828 posted

    Hi LWCARAB,

    The account that your ASP.NET code is running as needs the rights to do whatever you're trying to do.

    You should give enough permission to the asp.net accout(IIS_Users).

    Please check the following link:

    http://support.microsoft.com/kb/329291

    Monday, May 2, 2011 4:07 AM