OpenLightGroup Blog

rss

Blogs from OpenLightGroup.net


How To: Modify DotNetNuke Web.Config with the ConfigEditor Module

In this example I will demonstrate how to modify a DotNetNuke 4.x site to use .Net 3.5 by using the ConfigEditor Module in a step-by-step fashion.

Before you being please verify that the .Net 3.5 framework is installed on the web server hosting the DotNetNuke installation. Making these changes without .Net 3.5 installed on the web server will crash your site!

 

1. Download the ConfigEditor module install package from the CodePlex site.

2. Log in as a SuperUser (the default “host” account for example).

3.  Select the Module Definitions page from the Host menu.

ModuleDefinitions

4. Select Install New Module from the actions menu.

ModuleActions

5. Browse to the OpenLight.ConfigEditor_01.01.00_Install.zip file that you downloaded from the ConfigEditor site and click the Install New Module button.

InstallNewModule

6. After the module installs, click the Return link.

7. Navigate to a page that you want to place the module. Keep in mind when choosing the page that this module is only viewable by a SuperUser account such as the default host account.

8. Select ConfigEditor from the list of modules and click the Add button.

AddModuleToPage

You should now have a module that looks like this:

ConfigEditor

The textbox contains the XML from the web.config file in the root of your DotNetNuke site.

9. Now scroll through the XML and find <system.coded> section and replace it with this:

<system.coded>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
      <compiler language="vibe;vs.;visualbasic;vbscript" extension=".vibe" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="OptionInfer" value="true"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
    </compilers>
</system.coded>

10. Next find the <assemblies> section of the XML and replace it with this:

<assemblies>
        <add assembly="Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>

11. The final change to the web.config is to find the <controls> section and replace it with this:

<controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>

12. Once you have made these changes enter a name for the backup file you are going to create into the “Create Backup” text box.

CreateBackupAndSave

A few notes about the “Create Backup” feature:

  • If Create Backup is checked, a copy of the unchanged web.config will be saved to the root folder for the current portal. (i.e. ~/Portals/0/web.config.ceb)
  • If a name is entered in the text box, a file will be created using the name entered and will add a .ceb extension to the name. (ceb = Config Editor Backup)
  • If no name is entered in the text box, the file will be named web.config.ceb.
  • If a file already exists with the same file name, it will be overwritten.
  • This file can be used to restore the web.config to a previous state.  Only file with a .ceb extension will be allowed to be used for a restore operation.
  • Please keep in mind that if the changes made to the configuration are invalid your site might not run and therefore you would not be able to use the restore feature of this module. This feature is used only to restore a previous version of a valid configuration, in case you want to “roll back” the changes you made and use .Net 2.0 again for example.

13. Click the Save button to create a backup of your web.config file and save the changes you have made.

14. You will be asked to confirm the changes before they are made. Press OK to continue.

ConfirmSave 

15. Once the save is complete you will see “Web.config has been updated.” displayed under the Save button.

Your site is now ready to use the new features of the .Net 3.5 framework. This includes LINQ, Lambda and other goodies. The productivity increase from developing modules using ASP.Net 3.5 is amazing, and I cannot recommend it enough. This tutorial will allow you to experience those gains in your module develop and/or use 3rd party modules that have been developed using these technologies.

I hope you have found this tutorial and module to be helpful and easy to use. I plan to publish a tutorial in the near future to explain how to restore the web.config file from a backup file created during a save.

If you have questions, issues or features requests please use the ConfigEditor CodePlex site to post these items.





Comments are closed.
Showing 5 Comments
Avatar  Ian T. Lackey 8 years ago

I am sorry to hear you are having issues. After first glance, I am not sure that the changes listed in this article would cause &quot;redirecting&quot; errors. However, please post as much detail as possible in the discussion for this project on codeplex and I will be happy to help.&lt;br&gt;Here is a link to the codeplex project: &lt;a href=&quot;http://configeditor.codeplex.com/&quot; rel=&quot;nofollow&quot;&gt;configeditor.codeplex.com/&lt;/a&gt;

Avatar  Sian 8 years ago

Hi&lt;br&gt;&lt;br&gt;I just followed your tutorial, and I am getting some weird results. I can access some pages fine, but when I try an access others, I get an error that The page isn't redirecting properly ? For example, I can access the Users admin page from the control panel at the top right, but I can't access site settings ... and I can access all my content pages except one that has a form on it ? &lt;br&gt;&lt;br&gt;I am running DNN 4.9.5 and I have an XMod form that needs to access some Ajax functionality (for which I need .Net 3.5).&lt;br&gt;&lt;br&gt;Any idea what in the changes above could cause this ?&lt;br&gt;&lt;br&gt;Also, I noticed that you have an error in the code - the firt part you suggest to replace says locate the section .. it should be the section ...&lt;br&gt;&lt;br&gt;Please come back to me on this.&lt;br&gt;&lt;br&gt;Many thanks&lt;br&gt;Sian

Avatar  Yachtcharter Griechenland 8 years ago

That's great, I never thought about Modify DotNetNuke Web.Config with the ConfigEditor Module like that before.&lt;br&gt;

Avatar  Ian T. Lackey 8 years ago

Yes you are right the 5.x versions of DNN have the 3.5 upgrade option built in. This module targets 4.x installations. &lt;br&gt;&lt;br&gt;Did you say there needs to be changes made to the post, that I am missing some changes that need to be made to get 3.5 working? If so please let me know what they are and I will update the post. &lt;br&gt;&lt;br&gt;Thanks for your feedback!

Avatar  Jeff B. 8 years ago

needs changed to &lt;br&gt;&lt;br&gt;Thanks for posting the code. I had recently installed .net 3.5 and was researching how to upgrade DNN 5.0.1. Came across here to try it out. Then after doing it the hard way and failing a few times, I found out under host settings in the 5.x series, there is a handy dandy button that appears on detection of 3.5 which allows for upgrading 5.x.&lt;br&gt;&lt;br&gt;My next step is to upgrade to the latest (not so buggy) 5.1&lt;br&gt;&lt;br&gt;There are also a few other changes needed before using 3.5 in and additional entries need added to . Probably a few other places too.....