This help is very specific and only applies to Microsoft's .NET framework and how to arrange these 2 specific files. It does not go into available options as there is ample documentation at Microsoft or in NET documentation. It is more of a conceptual architecture that is important to understand.
These two files are critical in your website setup and are usually overlooked. Think of them as "Global" application settings. Web.config(WC) is a new powerful configuration file written in XML that enhances old global.asa(GA) files while global.asax(GX) files are basically the same as GA and is needed to separate ASP and NET applications.
It is important to understand a few things:
- Both ASP and NET applications can run from the same folder but they do not share state information. It is best to consider them separate applications.
- GX and WC files can appear just about anywhere in your website eliminating the old GA limitation (root or 2nd level subdirectory only).
- Unlike GA files WC files inherit any settings made in their parent directory. This greatly improves the model but requires special consideration in a multiple application environment.
- WC files are for configuration settings and are stored in XML format. This includes security, session, authorization and most old Session/Application variables. Previously you "configured" the web via VBScript code in GA file.
- GX files are code files that have application/session/request start and end global functions. These functions in themselves are very powerful. Coupled with WC files and global configuration just got a lot easier. VBScript is not supported. Use VB or C# or other language.
You will find that many things that were previously done in the GA file will now migrate to WC file. These include many application/session settings, security, localization and lot's of other stuff. Since .NET handles security much better than ASP you probably will want to integrate/replace any current security.
If you intend to have several independent applications on the same server....
- Your root GX and WC files should be very simple with only global defaults set. No security, authorization. Include generic error handling, maybe browser detection.
- Each application has Detailed/Override definitions with tight security/authorization. Include Session handling, browser specifics, keys, detailed application error handling and other stuff.
If you intend to have one "Global" application on the server...
- Your root GX and WC files should include all defaults including security, authorization, browser detection setup, session handling, browser specifics, detailed application error handling, keys and other options .
- Each application should only include GX and WC files if they need to override the root configuration.
These are core files. How you configure them will greatly affect the usability of your website. Take time to think about how you want to configure these. There are many ways to architect your site, choosing the best will just make life easier in the long run. View lot's of example WC files to see various options. I have yet to see one with every built in option defined, plus you can add your own configuration options, sections, whatever. Your knowledge of GA files is portable to GX files with a few minor adjustments. The real learning curve is the WC files and how best to use them. Understanding of XML is required for WC files.
One way or another you are being dragged into the XML clan. You can come kicking or accept it. Either way XML is inevitable. IBM, Oracle, and Microsoft say so.