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

Custom Resource Provider

Rate me:
Please Sign up or sign in to vote.
4.64/5 (16 votes)
5 Mar 2009Public Domain2 min read 44.6K   1K   23  
Custom resource provider to facilitate fetching global resources using HTML markups
using System;
using System.Web.Compilation;
using System.Threading;
using System.Diagnostics;
using System.Globalization;

namespace CustomResourceProviders
{

    /// <summary>
    /// Provider factory implementation for external resources. Only supports
    /// global resources. 
    /// </summary>
    public class ExternalResourceProviderFactory : ResourceProviderFactory
    {

        public override IResourceProvider CreateGlobalResourceProvider(string classKey)
        {
            Debug.WriteLine(String.Format(CultureInfo.InvariantCulture, "ExternalResourceProviderFactory.CreateGlobalResourceProvider({0})", classKey));

            return new GlobalExternalResourceProvider(classKey);
        }

        public override IResourceProvider CreateLocalResourceProvider(string virtualPath)
        {
            throw new NotSupportedException(String.Format(Thread.CurrentThread.CurrentUICulture, Properties.Resources.Provider_LocalResourcesNotSupported, "ExternalResourceProviderFactory"));
        }
    }
}

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 A Public Domain dedication


Written By
Software Developer (Senior) Geometric
India India
B.E. in Information Technology
MCTS(.NET 2.0 )

Comments and Discussions