Saturday, July 31, 2010
  Search
 
Register
Login
 
Converting a CSS Template To a DotNetNuke Skin
Creating DotNetNuke Skins can be a time consuming task. But, it's really not that hard and it doesn't have to be if you can use templates to help get started. Why not convert some free templates from...

Find this article and more in the category

Read This Article . . .

How to Install and Configure ActiveDirectory Provider for DotNetNuke 5.0
 The directions for installing and configuring extensions in DotNetNuke 5.0 are very similiar, but slightly different than from previous versions. Here's how to install the ActiveDirectory authentica...

Find this article and more in the category

Read This Article . . .

Quick Check for Troubleshooting the CodeEndeavor Ajax Templates
I haven’t just installed the the template and created a module out of the box yet. However, I have come across a few things that I know to check and fix and I’m up and running in no time at all. If y...

Find this article and more in the category

Read This Article . . .

Setting Up the DotNetNuke Side of Multi-Websites
Ok, so by now you know that DotNetNuke can handle multiple websites, but you still want to know why. Well, it’s pretty easy once you know how to do it, but it can be pretty confusing to some who are ...

Find this article and more in the category

Read This Article . . .

Creating new DotNetNuke HTTP Alias Records
 Setting up DotNetNuke to handle serving requests for Portal Alias records is a breeze. You can use these records to direct your site to handle requests for multiple domain names to one website with ...

Find this article and more in the category

Read This Article . . .

Dude, Where’s my web.config file? Resolve Installation DNN Error Message: BC30451: Name 'Config' is not declared
Sometimes troubleshooting DNN errors can be a royal pain. Fortunately, if you know what you're looking for installation errors are usually pretty easy to resolve. Unfortunately, if you don't know wha...

Find this article and more in the category

Read This Article . . .

Simple Intro to the DNN UserInfo Class
 New DNN developers often wonder how to expose information about logged in users to a custom DotNetNuke module. So, I threw together a very simple example to show how easy it is to begin using the bu...

Find this article and more in the DotNetNuke category

Read This Article . . .

Adding Google AdSense with Video
Adding Google AdSense to your DotNetNuke portal has never been easier. By default, a Google AdSense module is added the list of installed modules when your DNN portal is first created. It's easy to ...

Find this article and more in the Modules category

Read This Article . . .

Creating a Virtual Directory in IIS
One of the first things you will need to do prior to installing DotNetNuke on a server is to create a virtual directory which will host your DotNetNuke website.  If you have full control over you...

Find this article and more in the IIS & ASP.NET category

Read This Article . . .

Everything You Never Wanted to Know About the Config File
This is the "pre-" first installment in a series that will cover the parts of the web.config file to give you an idea of how to manipulate and customize your DotNetNuke portal. The web.config fi...

Find this article and more in the category

Read This Article . . .

Recently Added Articles

Minimize
Article List

 

Everything You Never Wanted to Know About the Config File

11/21/2008 3:27:35 AM - By Briana Tarrance

Category: | | Comments 1

 

Author's Note: I realized that it may be best to just start at the ground level before I get started in an article series entitled, "Anatomy of a DNN web.config file" . There are a lot of new enthusiasts out there who may benefit from the background info before we jump in. So, without further adue...     

This is the "pre-" first installment in a series that will cover the parts of the web.config file to give you an idea of how to manipulate and customize your DotNetNuke portal. The web.config file is one touchy little beast however, so you must tread easy when you're walking in its territory. One ill character could leave your site in a deadened state and fixing it can be trouble, especially, if you're not even aware of what you did to cause it.

I guess it is best to start at the beginning and cover some background info first. If you're brand new to development and to web.config files, you can check out some other articles on the site that can help. (Check the related links section on the right).

Web.config files are not specific to only DotNetNuke websites, but are used in .Net web applications in general. However, there are configuration settings that are specific to DotNetNuke found in your DNN web.config file that you won't find in non DNN sites.

What Exactly is a Web.Config File Anyway?

At the most basic definition, a web.config file is simply a XML structured file that lists settings used in your web application. It can be used to define settings such as connection strings to a database or authentication mode settings for example. Also, because config files are stored as XML files, any text based editor can be used to modify or create the file. No special software is required.

The .net config system is an extensible system that allows site developers to define specific configuration settings for websites that will guide how the entire site operates. Changes can be made to the web.config at any time with minimal impact on the operation of the site.

This allows you to make system changes on the fly without requiring you to reboot, recompile or redeploy the site. You can make changes on the server and hit save and the changes will take effect immediately.

Any time you make a change to the web.config file however, note that it will cause the website application pool to recycle itself which will cause a slightly longer load time the first time the site is hit after a change.

Order of Web.Config Operations

.Net websites can include many config files, so long as there is only one in any given directory. So for example, I can have a web.config file in the root directory of my website (c:\inetpub\wwwroot) and then another in (c:\inetpub\wwwroot\subdirectory).

The config file in my subdirectory can include specific settings that are only applied to the files found in that directory and will inherit the settings from my root web.config file, so I don't need to redefine those. Although, I can override those settings from the inherited web.config if I wanted to simply by redefining those in the subdirectory config file.   

At the heart of every .net enabled web server is a file called machine.config. This file is located on the server at systemroot\Microsoft.NET\Framework\Version\CONFIG\Machine.config. This file is the granddaddy master of all the config files. It dictates how the entire server is configured and is also the file that all of the web.config files in all the root directories of all the websites on the server inherit from.

And More Benefits of Config Files

A couple of other things worth mentioning is that because the system is extensible, new sections and configuration parameters can be defined by YOU! You are not only limited to the sections defined in the Machine.config file.

Additionally, unlike javascript files, users can't browse to your .config file and view it. Windows IIS servers are configured so that they don't server requests for .config files. This is very important because we don't want our application settings exposed to the Curious George's of the worlds…especially things like connection string user id's and passwords.

Basic Format, or Structure, of a Config File

Config files contain a collection of settings formatted as a nested hierarchy of XML tag. The tags (and subtags) include attributes that actually specify the configuration settings.

Config files must be well-formed XML and are case sensitive. You'll realize this the first time you modify your web.config file and see the heart stopping yellow error screen of website death and aren't sure what in the world you just did to kill the site. One simple syntactical error or malformed tag will cause this to happen, so just keep that in mind when your working.

The first, or beginning, section of the .config file is the section and is the Root XML tag. All other sections are found in between this section. Inside of the section, there are two main areas: the configuration section HANDLER DECLARATION area and the configuration section SETTINGS area.

The handler declaration are appears at the top of the config file and in between the tags. This is where you will notice many of the DNN specific settings. The

declarations in this area must provide a corresponding section found later in the config file that define the specific configuration information as well as the class that processes the configuration data for that specific section.

Tag names and attributes are always camel cased. This means that the first character of the tag name is lowercase the first letter of any subsequent concatenated words are in uppercase like this: myCamelCasedTag.

Conversely, attribute values are Pascal cased. This means that the first character of the attribute is upper cased, as well as any subsequent concatenated word like this: MyAttributeIsPascalCased.

*the only exception to this are for the attributes "true" and "false", which are ALWAYS lowercase.

Putting it all together we would have a tag like this:

      <myCamelCasedTag="true" myAttributeCasing="PascalCased" />


Whew! Is that just about enough for one day or what?

Ok, now that you have the quick (??) overview of the web.config file and what it means and provides for your site, you're ready to tackle the DotNetNuke specifics, which we'll begin covering in the next article, the real first article of the Anatomy of a DNN Web.config File series. Stay Tuned!

   

   

   

   

powered by metaPost


 

Related Articles
I Need to Modify the What to Install DNN? What in the World is a Web.Config File Anyway??
Dude, Where’s my web.config file? Resolve Installation DNN Error Message: BC30451: Name 'Config' is not declared
SERIES: Anatomy of a DNN Web.Config File-connectionStrings

 
 
Copyright 2008 by Virtual-Essentials.com Privacy Statement    Terms Of Use