.NET Tutorials
Oct9

Written by:Timothy
10/9/2008 10:53 PM

Well, due to .NET hosting problems with running DotNetNuke under Medium trust, I decided to grab the latest version and try again from scratch.  The site was previously plagued with "FileIOPermission" errors because of the way DotNetNuke was built for Medium Trust.  Anyways, with a bit of finaggling, I was able to get the framework running again, this time with virtually no error messages.  In this first post, I'm going to talk about how to set up DotNetNuke on a .NET 2.0 Medium Trust hosting environment that does not have AJAX installed, such as that of 1and1 or other similar shared hosting companies.

Now I know most of you probably don't care about how I came to the solution, so there's a quick summary of everything you need to get DNN 4.9.0 working on a 1and1 shared server at the bottom of this posting.

First off, I want to talk a bit about the problems I was having previously.  I'm not fully sure if the cause was DotNetNuke, or 1and1, or just both in combination.  In my previous version, the site was running relatively stable except that when the application stopped (automatically after inactivity), the first user to the site would then be welcomed with a FileIOPermission error.  Subsequent page loads worked fine after that, but it's the first impression that makes the biggest impact, right?  I believe the issue was that since I had my DNN installed on the root of my website, it would occasionally fail to see the path and try to access a file outside of my user space.  This is a big no-no in Medium Trust.

My first attempt at reinstalling involved blowing away the database and files and just doing another reinstall, this time into the /content subfolder.  I knew from previous experience that the installation seemed to often fail for me while installing the modules on the site, so I decided to try a different approach.  I figured that file ownership would be a stronger tie than setting the permissions manually, so I decided to try unzipping the DNN files from within code, rather than using the WebFiles manager.  This seemed to work better as I wasn't getting any errors once browsing the site after installation.  I was ecstatic... Until I tried to acccess the host and portal settings.  Then I got a similar but different FileIOPermission error.  This time it was from a reflection call that was failing the FileIOPermission security check for a Validator control.  Looking closely at the error I discovered a source was the script manager (using AJAX).  After some research online, digging into the DNN source code, and messing around with .NET reflector, I was able to discover the source of the problem: within the .net framework itself.  I didn't want to rewrite the validation controls for DNN some I came up with a simpler solution: disable AJAX.  After that, the entire site has worked great, and I have yet to see an error.

So here goes... Everything you need to get DNN 4.9.0 working on a 1and1 shared hosting environment:

Using 1and1 WebFiles application (or your own host's file manager application):

  1. Create/Empty a subfolder to hold your DotNetNuke files
  2. Upload the DotNetNuke_04.09.00_install.zip file to the new folder.  DO NOT unzip these files yet.
  3. Right click on the subfolder and select "Security."  Set all permissions for the NETWORK SERVICE and IUSR_ accounts.  Ensure that "Folder, subfolder, and files" is also selected in the dropdown.  Click OK.
  4. Upload a copy of ZipManager (This is the extremely basic asp.net program I wrote to unpack a zip file) to the root of your website.  You can download a copy from the Code Library.
  5. Unzip the ZipManager files now.

That's all we need to do from WebFiles, so you can close that window now.  Keep your 1and1 control panel open, because you'll need it again after the DNN installation completes.  Next we start the installation process:

  1. Browse to the zipmanager.aspx file on the root of your website.  ex. www.programmersanonymous.net/zipmanager.aspx
  2. Select your DNN subfolder in the dropdown list.
  3. Click on the .zip file for the DotNetNuke files.  They will immediately start to unpack in the same folder, so just wait for the page to finished loading.  By unzipping the files this way, it ensures that the NETWORK SERVICE user is the owner of all of the DNN files and folders.
  4. Browse to your website path with the DNN files.  ex. www.programmersanonymous.net/content The DotNetNuke Installation wizard should now come up.
  5. Follow the installation wizard using whatever settings your choose.
  6. When you get to your website, everything should appear to be working perfectly, until you log in as host and try to use one of the settings functions.  Then the FileIOPermission security access check error will apear. 

To fix this, we need to disable AJAX.  Normally this would be done using Host Settings, which we currently can't access.  So instead, we need to run a database script to disable it manually.  Open your SQL admin tool and run the follow SQL script: (Be sure to update the table name if you added a table qualifier during installation)

INSERT INTO HostSettings (SettingName, SettingValue, SettingIsSecure)
VALUES('EnableAJAX', 'N', 0);

This script will manually insert the seting to disable AJAX and thus, the FileIOPermission error we have been receiving.

Go back into WebFiles and delete the ZipManager files, so that no one can come in and mess up your installation.

You can now navigate back to your website and viola! Everything should now be working superbly!

 

Tags:

Re: Installing DotNetNuke 4.9.0 on 1and1 Webservers (or any Medium Trust Shared Hosting Site)

I Really appreciate you putting this together!

Unfortunately, I cannot get past step 1 in the second section (after webfiles). At my url http://www.resuflex.com/ZipManager.aspx I receive the error below:

Server Error in '/' Application.
--------------------------------------------------------------------------------

The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /ZipManager.aspx


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433



...which stumps me because I can verify that the file (and its accompanying resources) is there. Why would I receive this error? Any ideas?

Also, 1and1's webfiles manager won't save Modify and Write permission changes to folders or subfolders... only files.

???

By Texrat on  1/19/2009 2:18 PM

Re: Installing DotNetNuke 4.9.0 on 1and1 Webservers (or any Medium Trust Shared Hosting Site)

I'd give some obscure body part for a tutorial like this with screenshots or a screen video clip!

By Jason on  1/19/2009 2:18 PM

Re: Installing DotNetNuke 4.9.0 on 1and1 Webservers (or any Medium Trust Shared Hosting Site)

Have you tried using the new webfile application that's on their site? Also, I couldn't download the zipfilemanager beause the page kept asking me to loging after I had loged in. Please help.

By socoduce on  1/13/2009 2:06 PM

Re: Installing DotNetNuke 4.9.0 on 1and1 Webservers (or any Medium Trust Shared Hosting Site)

Texrat > Is your website forwarding that domain to another home folder?

Webfiles definitely does have issues with updating the permissions when doing entire subfolders. I built the zipmanager to deal explicitly with that problem. if the subfolder it is in has write permission, and then the files are unzipped by the webapplication, they should inherit the same permissions as that parent folder.


Socoduce > Zipmanager has no security features in it. it could be inheriting from a pre-existing web.config. Try removing it.

By Timothy on  1/19/2009 2:29 PM

Re: Installing DotNetNuke 4.9.0 on 1and1 Webservers (or any Medium Trust Shared Hosting Site)

The sql query did it for me. Props for that!

By jtpowell on  3/13/2009 12:45 PM