This file contains hidden or 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
| internal static class RequestTrackingConstants | |
| { | |
| /// <summary> | |
| /// Name of the HttpContext item containing RequestTelemetry object. | |
| /// </summary> | |
| internal const string RequestTelemetryItemName = "Microsoft.ApplicationInsights.RequestTelemetry"; | |
| internal const string EndRequestCallFlag = "Microsoft.ApplicationInsights.EndRequestCallFlag"; | |
| /// <summary> |
This file contains hidden or 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
| class CapturingResponseFilter : Stream | |
| { | |
| private Stream _sink; | |
| private MemoryStream mem; | |
| public APIAccessLogItem AccessLogItem { get; set; } | |
| public CapturingResponseFilter(Stream sink, APIAccessLogItem item) | |
| { | |
| _sink = sink; |
This file contains hidden or 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.Collections.Generic; | |
| using System.Linq; | |
| using System.Web; | |
| using System.Web.Mvc; | |
| using System.Text; | |
| using System.IO; | |
| using System.Web.UI; | |
| using Pechkin; | |
| using System.Text.RegularExpressions; |
This file contains hidden or 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.Net; | |
| using System.Net.Http; | |
| using System.Web; | |
| using System.Web.Caching; | |
| using System.Web.Http.Controllers; | |
| using System.Web.Http.Filters; | |
| /// <summary> | |
| /// Decorates any Action that needs to have client requests limited by concurrent requests. |
This file contains hidden or 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)] | |
| public class ValidationActionFilterAttribute : ActionFilterAttribute | |
| { | |
| public override void OnActionExecuting(HttpActionContext actionContext) | |
| { | |
| InnerOnActionExecuting(actionContext); | |
| var modelState = actionContext.ModelState; | |
| if (modelState.IsValid) |
This file contains hidden or 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.Collections.Generic; | |
| using System.Configuration; | |
| using System.Linq; | |
| using System.Web; | |
| using System.Web.Mvc; | |
| namespace Web.Attributes | |
| { | |
| public class RestrictByIpAddressAttribute : ActionFilterAttribute |
This file contains hidden or 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 Auction.Web.Domain; | |
| using Auction.Web.Domain.Commands; | |
| using Auction.Web.Domain.Entities; | |
| using Auction.Web.Domain.Queries; | |
| using Facebook; | |
| using Microsoft.Web.WebPages.OAuth; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Configuration; | |
| using System.Linq; |
This file contains hidden or 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 BeforeAttribute : ActionFilterAttribute { | |
| public BeforeAttribute() { | |
| Methods = string.Empty; | |
| Except = string.Empty; | |
| Only = string.Empty; | |
| } | |
| public BeforeAttribute(params string[] methodNames) : this() { | |
| Methods = string.Join(" ", methodNames); | |
| } |
This file contains hidden or 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 RequireApiKey : ActionFilterAttribute | |
| { | |
| private static readonly ILog Logger = LogManager.GetLogger(typeof(RequireApiKey)); | |
| public override void OnActionExecuting(HttpActionContext context) | |
| { | |
| var ipAddress = GetIpAddress(context); | |
| Logger.InfoFormat("API attempt. Uri {0} - IP {1} - Headers {2} ", context.Request.RequestUri, ipAddress, context.Request.Headers); | |
| IEnumerable<string> values; | |
| if (context.Request.Headers.TryGetValues("ApiKey", out values) && GetApiKeys().Any (x => x ==values.First()) |
This file contains hidden or 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.Net; | |
| using System.Web.Mvc; | |
| using System.Web.Routing; | |
| namespace Web.Filters | |
| { | |
| /// <summary> | |
| /// Check whether the application is marked as offline in the config file. | |
| /// If so, and the user does not have the override permission, throw an exception. |