I am using Web Matrix and C#. When I run code in .aspx file at home on my laptop, it works perfect with no errors. However when I try and run it on a computer in my college lab I get the following errors....
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: Request failed.
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:
<%@dotnet.itags.org. 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: Request failed.]
DatabaseConnect.DBConnect.Details() +0
DatabaseConnect.DBConnect.Main() +10
_ASP.common_ascx.Page_Load(Object sender, EventArgs e) +44
System.Web.UI.Control.OnLoad(EventArgs e) +55
System.Web.UI.Control.LoadRecursive() +21
System.Web.UI.Control.LoadRecursive() +84
System.Web.UI.Page.ProcessRequestMain() +2095
System.Web.UI.Page.ProcessRequest() +115
System.Web.UI.Page.ProcessRequest(HttpContext context) +18
System.Web.CallHandlerExecutionStep.Execute() +179
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
From my understanding of the error, it seems a security/permissions problem but not sure what I should ask or say to the administrator about it or what fix I should suggest. Any suggestions please? Also as the files will be hosted on a web server soon, is it possible I may get the same problems there?
Help is really needed on this and would be extremely appreciated.Set debug to true in the page directive. It will tell you more information then now. After that you may have more information, which will help you.
Thanks for your response sonukapoor. I have debug set to true on the .aspx page and both the user controls for this page and the same error as above is displayed.
Anymore ideas please?
As I can see in the stack you're using a database conneciton somewhere. Check what you're doing on line 44 of the common.ascx (see stack trace to find out which file it really is). An interesting post on-line is this: <a hef="http://www.error-bank.com/microsoft.public.dotnet.security/3764_Thread.aspx">http://www.error-bank.com/microsoft.public.dotnet.security/3764_Thread.aspx</a> which covers a similar situation where an Access db was used, causing security problems.
Yes this is correct I am using a Access database connection. There is no line 44 in common.ascx. The entire code for this .ascx file is
<%@. Control Language="C#" %>
<%@. import Namespace="DatabaseConnect" %>
<script runat="server"
void Page_Load(Object sender, EventArgs e) {
if(Session.IsNewSession)
{
DBConnect db = new DBConnect();
db.Main();
}
}
</script
This user control checks to see if it is a new session and if its a class is instansiated, a connection with an access database is made and data is read into variables. From what you are saying I would think the problem is with instansiating the class. Possibly I may not have sufficent permissions to instansiate a class, would this be possible?
Also I went through the link you gave and the instructions specified are not possible for me to do as I dont have admin permissions on the machine in question.
I think you need to print out that artical and give it to the admins at your school - they can make the changes. I'm sure you're not the first with this problem...
Thanks for all the help, I just emailed the administrator with the links and details.
Will report back soon.
If anyone else has any suggestions, please post as it is really important I get this sorted soon.
0 comments:
Post a Comment