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

ASP.NET MVC Result Cache

Rate me:
Please Sign up or sign in to vote.
3.67/5 (9 votes)
17 Feb 2009GPL3 69.6K   512   21  
Cache the ActionResult using an ActionFilter
using System;
using System.Linq;
using System.Security.Principal;

namespace CompanyFeeds.Tests.Fakes
{

    public class FakePrincipal : IPrincipal
    {
        private readonly IIdentity _identity;
        private readonly string[] _roles;

        public FakePrincipal(IIdentity identity, string[] roles)
        {
            _identity = identity;
            _roles = roles;
        }

        public IIdentity Identity
        {
            get { return _identity; }
        }

        public bool IsInRole(string role)
        {
            if (_roles == null)
                return false;
            return _roles.Contains(role);
        }
    }



}

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 GNU General Public License (GPLv3)


Written By
Software Developer
Spain Spain
Jorge has been working in Software development for more than 10 years. Born in Argentina, he lives in Spain since 2004.

He worked as a consultant for mayor companies including Log, HP and Avanade and holds some technical certifications including MCSD and MCAD.

He is the founder of the asp.net mvc forum open source project Nearforums, the Node.js Cassandra driver and the owner of the news release site prsync.com.

Follow him on Twitter: twitter.com/jorgebg

Contact: jorgebaygondra at gmail

Comments and Discussions