I recently purchased some ASP.NET 2.0 components. One of these components is a report generation component. I was anxious to try it out since like the rest of you I always have a ton of reporting to create. So I plunked the control on the default.aspx page, set the parameters, one of which included a reference to the demo NWind.mdb database in my file system. When I went to build the site, I kept coming up with the System.Web.AspNetHostingPermission blah blah blah Failed error.
So of course, I turn to Google to try to solve the problem. Well I came up with tons of people who had this problem or some variant but not too many solutions. There was either no answer to the post or there was the security expert answer to the problem which involved a whole lot more theory than I wanted at the moment. I just wanted a simple solution to get a simple test program to complie and run.
Finally I got it. Here are the steps needed to fix the problem:
1) Run the MMC (Start -> Run -> MMC, Enter)
2) Add the Mscorcfg.msc snap-in which is a graphical interface to the .NET 2.0 Configuration Tool. (Select File -> Add/Remove Snap In …). Click the Add button and select .NET Framework 2.0 Configuration from the list of snap-ins that appear. Click the Add button.
3) Navigate to and click on Runtime Security Policy. Click on Adjust Zone Security.
4) In the window that pops up, select from either “Make changes to this computer” or “Make changes for the current user only”. In the next screen, select Intranet and move the slider to full. Close out of the windows as appropriate.
If you did all this while Visual Studio was open, close Visual Studio and reopen it. Compile your project and you should be good to go.