XamlHostingConfiguration.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Xaml.Hosting / System / Xaml / Hosting / Configuration / XamlHostingConfiguration.cs / 1305376 / XamlHostingConfiguration.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.Xaml.Hosting.Configuration 
{
    using System; 
    using System.Configuration; 
    using System.Web.Configuration;
    using System.Runtime; 
    using System.Security;

    static class XamlHostingConfiguration
    { 
        internal const string CollectionName = "";
        internal const string HttpHandlerType = "httpHandlerType"; 
        internal const string XamlHostingConfigGroup = @"system.xaml.hosting"; 
        internal const string XamlHostingSection = XamlHostingConfigGroup + "/httpHandlers";
        internal const string XamlRootElementType = "xamlRootElementType"; 

        internal static bool TryGetHttpHandlerType(string virtualPath, Type hostedXamlType, out Type httpHandlerType)
        {
            XamlHostingSection section = LoadXamlHostingSection(virtualPath); 
            if (null == section)
            { 
                ConfigurationErrorsException configException = new ConfigurationErrorsException(SR.ConfigSectionNotFound); 
                throw FxTrace.Exception.AsError(configException);
            } 
            return section.Handlers.TryGetHttpHandlerType(hostedXamlType, out httpHandlerType);
        }

        static XamlHostingSection LoadXamlHostingSection(string virtualPath) 
        {
            //WebConfigurationManager returns the same section object for a given virtual directory (not virtual path). 
            return (XamlHostingSection)WebConfigurationManager.GetSection(XamlHostingConfiguration.XamlHostingSection, virtualPath); 
        }
    } 
}


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK