E
Edwin Alexander
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
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