Hi,
I've developed an ASP.NET application running 2.0. I am having trouble accessing the database. Here is a brief code snippet:
---------------------------------------------------------------------------------------------------------------------------------------
strConnect = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & strPath & "\" & strDBName
DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open(strConnect)
---------------------------------------------------------------------------------------------------------------------------------------
I got the code from GoDaddy. Here is the issue, when I run the web page from VS 2003 it can access the database with no problems. But when I run the page from LocalHost or on the GoDaddy server where it sits I get a "Security Exception". The database sits on my local drive at c:\inetpub\wwwroot\access_db.
Why is it that I can get it to work just fine when VS runs the page but I keep getting a security exception when running it from IE off of localhost or GoDaddy? I included the text from the web page in case it is any help. And yes I did add the debug="true" statement, compiled it in debug mode, etc, but I keep getting the same page. I also put copies of the database in the KRFeedback directory. I'm totally lost. If I have to change the trust level in the config file then how do I do that.
Server Error in '/KRFeedback' 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: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 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:
<%@ 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 for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Web.HttpServerUtility.CreateObject(String progID) +34
KRFeedback.WebForm1.UpdateDB2() +106
KRFeedback.WebForm1.btnSubmit_Click(Object sender, EventArgs e) +676
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.feedback_aspx.ProcessRequest(HttpContext context) +29
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
|
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
Thank you