This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AttributeUsage(AttributeTargets.Class,AllowMultiple = false, Inherited = false)] | |
public class CacheAttribute : Attribute | |
{ | |
/// <summary> | |
/// The name of the cache profile to be used | |
/// </summary> | |
public string ProfileName { get; set; } | |
/// <summary> | |
/// Lifespan of the response in the cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AutoMoqControllerDataAttribute : AutoDataAttribute | |
{ | |
public AutoMoqControllerDataAttribute() | |
: base(new Fixture() | |
.Customize(new AutoMoqControllerCustomization())) | |
{ | |
} | |
} | |
public class AutoMoqControllerCustomization : CompositeCustomization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApiIntegrationFixture : IDisposable | |
{ | |
public ApiIntegrationFixture() | |
{ | |
var config = new HttpConfiguration(); | |
WebApiConfig.Register(config); | |
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; | |
//remember to add all filters | |
config.Filters.Add(new ValidationActionFilter()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Quick deploy to various environments. | |
.DESCRIPTION | |
Calls deploy.ps1 with relevant arguments for repeatable deployments. | |
.PARAMETER deployTo | |
Specify the environment to deploy to. Currently supports "Dev-CMS" and "Dev-CD" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApplicationManagement : IApplicationManagement | |
{ | |
private readonly IEnumerable<IApplicationSetting> _settings; | |
public ApplicationManagement(IEnumerable<IApplicationSetting> settings) | |
{ | |
_settings = settings; | |
try | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Email : IDisposable | |
{ | |
private SmtpClient _client; | |
private bool? _useSsl; | |
private Email() | |
{ | |
Message = new MailMessage(); | |
_client = new SmtpClient(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false, Inherited = true)] | |
public sealed class ValidateAntiForgeryTokenAttribute : FilterAttribute, IAuthorizationFilter | |
{ | |
public Task<HttpResponseMessage> ExecuteAuthorizationFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func<Task<HttpResponseMessage>> continuation) | |
{ | |
try | |
{ | |
//could add optional ajax header check here | |
AntiForgery.Validate(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MethodOverrideHandler : DelegatingHandler | |
{ | |
readonly string[] _methods = { "DELETE", "HEAD", "PUT" }; | |
const string _header = "X-HTTP-Method-Override"; | |
protected override Task<HttpResponseMessage> SendAsync( | |
HttpRequestMessage request, CancellationToken cancellationToken) | |
{ | |
// Check for HTTP POST with the X-HTTP-Method-Override header. | |
if (request.Method == HttpMethod.Post && request.Headers.Contains(_header)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.linq; | |
using System.collections.generic; | |
using System.IO; | |
using System.web.mvc; | |
namespace Securitymodule | |
{ | |
[Attributeusage (Attributetargets.method, Allowmultiple = false )] | |
public sealed class Allowuploadsafefilesattribute: Actionfilterattribute |