ASP.NET Assembly Security Error - Help

Results 1 to 2 of 2

Thread: ASP.NET Assembly Security Error - Help

  1. #1
    Join Date
    Dec 1969

    Default ASP.NET Assembly Security Error - Help

    ASP.NET Security Problem<BR>battleace - 6/18/2002 3:52:06 PM<BR><BR>--------------------------------------------------------------------------------<BR> I have some ASP.NET code which calls an assembly which in turn calls a SQL Server 2000 stored procedure. It says there is a security exception and that I should contact the administrator to correct the problem. <BR>In order to try and solve the problem, I changed the trust to FULL using the .NET configuration tool. I also changed the machine.config file to <BR>use the System username instead of machine username. <BR>None of this worked. <BR>Any ideas? I really need help I have tried and looked at everything that I can think of. <BR><BR>SEE ERROR BELOW <BR><BR><BR>One more thing, I moved the code to the web page . The code which executes the stored procedure. Instead of executing the proc I executed an insert statement directly in the web page and it worked. It seems to me that my assembly does not have proper permissions to run a proc on sqlserver. I gave ASPNET user execute rights on sqlserver but it still does not work. Any idea how I can be sure that my assembly has permissions to run a database stored procedure? <BR><BR>========================================== ======== <BR><BR><BR>Security Exception <BR>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&#039;s trust level in the configuration file. <BR><BR>Exception Details: System.Security.SecurityException: Request failed. <BR><BR>Source Error: <BR><BR><BR>Line 29: Engine cn = new Engine(); <BR>Line 30: <BR>Line 31: cn.Execute("sp_testproc",MyAssemblyConfiguration.A ppSettings.ConnectString); <BR>Line 32: <BR>Line 33: } <BR><BR><BR>Source File: c:inetpubwwwrootTESTAPPWebkaw.aspx Line: 31 <BR><BR>Stack Trace: <BR><BR><BR>[SecurityException: Request failed.] <BR> MyAssembly.Framework.Data.Sql.Engine.Execute(Strin g Sql, String ConnectString) +0 <BR> ASP.Webkaw_aspx.PostInfo_Click(Object sender, EventArgs e) in c:inetpubwwwrootTESTAPPWebkaw.aspx:31 <BR> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108 <BR> System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57 <BR> System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18 <BR> System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33 <BR> System.Web.UI.Page.ProcessRequestMain() +2077 <BR> System.Web.UI.Page.ProcessRequest() +118 <BR> System.Web.UI.Page.ProcessRequest(HttpContext context) +18 <BR> System.Web.CallHandlerExecutionStep.Execute() +179 <BR> System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +87 <BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: ASP.NET Assembly Security Error - Help

    It shouldn&#039;t matter what permissions that is executing under, except for the Engine object that you are using. Make sure that the sql server login that you are using in your connection string has execute permissions on &#039;sp_testproc&#039;. If you could post more of your code, I can probably help you diagnose this better, given its context. Is the Engine object a class that you built?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts