Skip to content

Instantly share code, notes, and snippets.

@jellebens
jellebens / AuthenticationController.cs
Last active December 22, 2015 10:59
Windows Identity framework SignOut
public class AuthenticationController : Controller
{
ILogger _Logger = NullLogger.Instance;
public AuthenticationController(ILoggerFactory loggerfactory) {
loggerfactory.Create(Loggers.Security);
}
[AllowAnonymous]
public ActionResult Index()
@jellebens
jellebens / StartAzureDevelopmentStorage.cs
Last active December 27, 2015 18:19
Start Azure Development Blob Storage emulator from code
private static void StartAzureDevelopmentStorage() {
const string processName = "DSServiceLDB.exe";
bool isStorageRunning = Process.GetProcessesByName(processName).Any();
string dir = typeof(BlobRepositoryTests).Assembly.CodeBase;
if (isStorageRunning)
{
ProcessStartInfo start = new ProcessStartInfo
{
Arguments = "/devstore:start",
public class MyAuthenticationManager : ClaimsAuthenticationManager
{
private readonly IWindsorContainer _container;
private readonly ILogger _logger;
public MyAuthenticationManager(IWindsorContainer container)
{
_container = container;
_logger = _container.Resolve<ILoggerFactory>().Create(Loggers.Security);
}
<system.webServer>
<staticContent>
<remove fileExtension=".woff"/>
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>
</system.webServer>
$.ajax({
url: '@Url.Action("Tasks", "Inbox", new { area = string.Empty })',
data: { userId : '@MyPrincipal.Current.Id' },
cache: false,
type: "GET",
success: function (data) {
$("#numberOfTaskListItems").html(data);
},
dataType: "json"
});
$.ajaxSetup({cache: false}});
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
namespace JelleBens.Common.Security
{
public class MyPrincipal : ClaimsPrincipal
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
body {
padding-top: 50px;
padding-bottom: 20px;
}
/* Set padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
}