Its hard to explain why this is happening to every 2nd developer and he is complaining about medium trust level problem with hosting company.
Microsoft explain step by step but still this problem doenst resolve WHY?
These steps are enough for developer. Why they are still complaining.
SOLUTION:
DONT USE DATAREADER WHEN YOU ARE BINDING YOUR DATA WITH DATAGRID, GRIDVIEW OR ANY CONTROL.
USE DATASET
NO need to follow below steps
NO need to do settings locally for your Application for Medium Trust Level.
Once you will deployed at hosted server, it will automatically inherit as medium trust level.
Microsoft said :
Summary of Steps
To use medium trust in your ASP.NET applications:
Step 1. Configure medium trust.
Step 2. Lock the trust level.
Step 3. Optionally create a custom policy based on medium trust.
Step 1. Configure Medium Trust
To configure an application to run with medium trust, add the following element to either the application's specific Web.config file in the application's virtual root directory or to the machine-level Web.config file.
Copy Code
Note If present, the originUrl attribute can be used by some permissions, such as WebPermission, to restrict connectivity to a defined set of addresses.
To configure all Web applications on a server to run with medium trust, add this element to the machine-level Web.config file located in the following folder: %windir%Microsoft.NETFramework{version}CONFIG.
By default, Web applications are configured to run with full trust as shown in the following default configuration from the machine-level Web.config file.
Copy Code
?
To review the full set of permissions available to medium trust applications, view the Web_mediumtrust.config file.
Step 2. Lock the Trust Level
Application service providers or anyone responsible for running multiple Web applications on the same server should apply the medium trust policy setting in the machine-level Web.config file and then lock the trust level for all Web applications.
To do this, set the allowOverride attribute to false in the machine-level Web.config file, as shown in the following code example.
Copy Code
?
By setting allowOverride="false", an individual developer is unable to override the medium trust policy setting in their application's Web.config file.
Yours comments are valuable for me
Joggee
http://blog.joggee.com