Re: ASP.NET Security Exception Error
- From: "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com>
- Date: Mon, 27 Jun 2005 10:10:44 -0400
Setting the AppDomain principal policy requires
SecurityPermissions\ControlPrincipal, which your application would appear to
lack. This limitation may be the result of either the CAS (code access
security) policy on the machine or the ASP.NET trust level at which your
application is running. Before you start modifying either policy, might you
be able to answer the following questions:
1. Is this happening on your development machine or a server? If the
latter, is the problem server configuration expected to mirror the
production server?
2. Would you be permitted to dictate that your application run with
elevated CAS privileges in its production environment?
3. Do you have any idea why the relevant CAS policy or ASP.NET trust levels
might have been altered from their defaults in the first place?
"Edwin Alexander" <edwin@xxxxxxxxxx> wrote in message
news:1119545836.957175.253390@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> I'm new tothe ASP.NET framework and my first task is to create a web
> interface for an n-tier application. I'm getting the following error
> when trying to authenticate a forms-based login:
>
> "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."
>
> I've seen a number of people posting this error in the newsgroup and
> have examined the solutions. Some are assuming a technical prowess
> with .NET that I just don't have yet while others are akin to reading
> Swahili.
>
> Tracing through the program I've found that the error occurs on the
> line of code
>
> currentDomain.SetPrincipalPolicy(PrincipalPolicy.UnauthenticatedPrincipal);
>
> and yields the following stack trace:
>
> [SecurityException: Request for the permission of type
> System.Security.Permissions.SecurityPermission, mscorlib,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
> failed.]
>
> System.Security.CodeAccessSecurityEngine.CheckTokenBasedSetHelper(Boolean
> ignoreGrants, TokenBasedSet grants, TokenBasedSet denied, TokenBasedSet
> demands) +503
>
> System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet
> grants, PermissionSet denied, PermissionSet demands) +144
> System.AppDomain.SetPrincipalPolicy(PrincipalPolicy policy) +0
> [...]..ctor(String userID, String password, Boolean usePassword) in
> [...]principal.cs:51
> [...]Principal.Login(String userName, String password) in
> [...]principal.cs:45
> [...]tryLogin(String userName, String userPassword) in
> [...]login.aspx.cs:53
> ASP.Login_aspx.btnLogin_Click(Object sender, EventArgs E) in
> [...]Login.aspx:7
> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
>
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
> eventArgument) +57
> System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
> sourceControl, String eventArgument) +18
> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
> +33
> System.Web.UI.Page.ProcessRequestMain() +2112
> System.Web.UI.Page.ProcessRequest() +218
> System.Web.UI.Page.ProcessRequest(HttpContext context) +18
>
> System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
> +179
> System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
> completedSynchronously) +87
>
> If ignorance is bliss then I'm ecstatic right now. Can anyone help
> make sense out of this? I got the hint that it's a trust problem and
> that the Web.config file might be involved, but I don't want to be a
> Mad Bomber and create more problems than I solve.
>
> Thanks,
> Edwin
>
.
- Follow-Ups:
- Re: ASP.NET Security Exception Error
- From: Edwin Alexander
- Re: ASP.NET Security Exception Error
- References:
- ASP.NET Security Exception Error
- From: Edwin Alexander
- ASP.NET Security Exception Error
- Prev by Date: System.ExecutionEngineException during a P/Invoke call
- Next by Date: Re: Strong Naming using AssemblyDelaySign(true) and VSS
- Previous by thread: ASP.NET Security Exception Error
- Next by thread: Re: ASP.NET Security Exception Error
- Index(es):
Relevant Pages
|