Skip to content

Instantly share code, notes, and snippets.

View jglozano's full-sized avatar

Javier Lozano jglozano

View GitHub Profile
@jglozano
jglozano / P3PHeaderAttribute.cs
Created January 30, 2015 19:56
P3P Header for ASP.NET MVC
public class P3PHeaderAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
filterContext.HttpContext.Response.AppendHeader("P3P", "CP=\\\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\\\"");
}
}
//source: http://stackoverflow.com/questions/13975777/p3p-header-info-in-mvc
@jglozano
jglozano / .gitignore
Created February 5, 2015 20:52
Default .gitignore file
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
*.DotSettings
# Build results
@jglozano
jglozano / .gitattributes
Created February 5, 2015 20:53
Default .gitattributes
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
public override void Init() {
// Inject properties into the handler before execution
PreRequestHandlerExecute += (sender, e) =>
{
var app = sender as HttpApplication;
if (app == null) return;
var handler = app.Context.CurrentHandler;
if (handler == null) return;
public override void Init() {
// Inject properties into the handler before execution
PreRequestHandlerExecute += (sender, e) =>
{
var app = sender as HttpApplication;
if (app == null) return;
var handler = app.Context.CurrentHandler;
if (handler == null) return;
using System;
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using Spark.Web.Mvc;
namespace Dimecasts.Web
{
using MvcTurbine.ComponentModel;
using MvcTurbine.Web;
public class CommonServiceRegistration : IServiceRegistration
{
public void Register(IServiceLocator locator)
{
// use the GetUnderlyingContainer to get the 'internal' container the
// application is using
var container = locator.GetUnderlyingContainer<IWindsorContainer>();
// now you can leverage your container to it's needs
// yes, I know it smells of hack
@jglozano
jglozano / MVC2 Area Registration
Created April 14, 2010 18:27
shows how the system can handle registration of MVC2 Areas out of the box.
/// <summary>
/// Provides the auto-registration of MVC related components (controllers, view engines, filters, etc).
/// </summary>
/// <param name="registrationList"></param>
public virtual void AddRegistrations(AutoRegistrationList registrationList) {
registrationList
.Add(MvcRegistration.RegisterController())
.Add(MvcRegistration.RegisterViewEngine())
.Add(MvcRegistration.RegisterFilter<IActionFilter>())
.Add(MvcRegistration.RegisterFilter<IResultFilter>())
namespace FubuMvc.Blades.UI {
using FubuMVC.UI;
using FubuMVC.UI.Configuration;
using FubuMVC.UI.Tags;
using MvcTurbine.ComponentModel;
public class SupportingServiceRegistration : IServiceRegistration {
public void Register(IServiceLocator locator) {
// Register the common Fubu UI pieces
locator.Register<IElementNamingConvention, DefaultElementNamingConvention>();
namespace HtmlConventions {
using System;
using FubuMVC.UI;
using FubuMVC.UI.Configuration;
using FubuMVC.UI.Tags;
using HtmlTags;
public class CommonConventions : HtmlConventionRegistry {
public CommonConventions() {
Editors.Always.Attr("class", "test");