I have a simple ACCESS DB and am using a gridview to show the contents. Everything looks fine when run locally using my local ASP .NET dev server.
The shared hosting I use is Netfirms.com and they use a medium trust.
How do I set my Visual Web developer 2008 express website to use Medium trust for this website.
I can't find anything in Website -> ASP.NET configuration .
I found the MSDN web page at: http://msdn.microsoft.com/en-us/library/ms998326.aspx#paght000017_step3
"The main constraints placed on medium trust Web applications are:
1. OleDbPermission is not available. This means you cannot use the ADO.NET managed OLE DB data provider to access databases. However, you can use the managed SQL Server provider to access SQL Server databases.
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."
I'm getting the error message-->
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.Data.OleDb.OleDbPermission,
System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed.
"Overview
By default, ASP.NET version 1.1 and
version 2.0 Web applications and Web services run with Full trust. When
an application runs with Full trust, code access security places no
restrictions on the resources and operations it can access, and
resource access is based solely on operating system security and
Windows access control lists (ACLs).
To protect your ASP.NET
application, you can use code access security to restrict the resources
the application can access and the privileged operations it can
perform. You do this by configuring the <trust> element in
either the machine-level Web.config file or the application's
Web.config file and setting it to one of the predefined trust levels,
as shown here."
___________
NETFIRMS.COM, the webhost SAYS
Medium Trust Summary is available directly from Microsoft's website: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000020.asp
The main constraints placed on medium trust Web applications are:
1.
OleDbPermission is not available. This means you cannot use the ADO.NET
managed OLE DB data provider to access databases. However, you can use
the managed SQL Server provider to access SQL Server databases.
2. EventLogPermission is not available. This means you cannot access the Windows event log.
3. ReflectionPermission is not available. This means you cannot use reflection.
4. RegistryPermission is not available. This means you cannot access
the registry
5.
WebPermission is restricted. This means your application can only
communicate with an address or range of addresses that you define in
the <trust> element.
6. FileIOPermission
is restricted. This means you can only access files in your
application's virtual directory hierarchy. Your application is granted
Read, Write, Append, and PathDiscovery
permissions for your application's virtual directory hierarchy.
7. You are also prevented from calling unmanaged code or from using Enterprise Services.
NOTE: For additional ASP.NET support and resources we recommend the following web sites:
______________________
I tried adding
<trust level="Medium" originUrl="~/App_Data/SID_Dealers_Access2002-3.mdb" />
referring to an ACCESS 2003 DB
right after the <system.web> in the root directory web.config file
WHAT IS THE CORRECT SYNTAX AND LOCATION OF THE TRUST ELEMENT?
I assume that if I get the trust element entered connrectly in the root directory web.config file, this DB will run on the shared hosting.
Dave