Click here to Skip to main content
15,886,795 members
Articles / Web Development / ASP.NET

Introducing ASP.NET Page Modules

Rate me:
Please Sign up or sign in to vote.
3.81/5 (10 votes)
15 Apr 2010CPOL3 min read 57.4K   360   48  
This article introduces the concept of Page Modules, which are similar to HTTP Modules but related to Page Life Cycle, and the need for them.
using System;
using System.Configuration;
using System.Threading;
using System.Web.Compilation;

namespace PauloMorgado.Web.Configuration
{
    internal static class TypeUtils
    {
        internal static Type GetType(string typeName, string propertyName, ConfigurationElement configurationElement)
        {
            Type type;
            try
            {
                type = BuildManager.GetType(typeName, true, false);
            }
            catch (Exception exception)
            {
                if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
                {
                    throw;
                }
                if (configurationElement != null)
                {
                    throw new ConfigurationErrorsException(exception.Message, exception, configurationElement.ElementInformation.Properties[propertyName].Source, configurationElement.ElementInformation.Properties[propertyName].LineNumber);
                }
                throw new ConfigurationErrorsException(exception.Message, exception);
            }
            return type;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Paulo Morgado
Portugal Portugal

Comments and Discussions