Skip to content

Instantly share code, notes, and snippets.

View happygrizzly's full-sized avatar
🐻

Aleksey Filippov happygrizzly

🐻
View GitHub Profile
@happygrizzly
happygrizzly / gist:ba6d197ee096a1e0f6b5
Last active September 2, 2015 08:04 — forked from alexbeletsky/gist:1325577
ASP.NET MVC2 Views web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<httpHandlers>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>
<!--
Enabling request validation in view pages would cause validation to occur

Owin Authentication with Web API 2

Using Microsoft.Owin.Security along with .NET Web API 2 for authentication on Single Page Applications.

My example is split up into 2 different projects, API which is WebAPI2 project and MyProj which is a basic MVC that contains primarily only JavaScript/CSS/etc and the startup classes.

API > AccountController.cs

namespace API

{

using System;
using System.Threading.Tasks;
namespace Life
{
public class LifeSimulation
{
private bool[,] world;
private bool[,] nextGeneration;
private Task processTask;
public class RoleResourceActivity {
public Int32 ResourceId { get; set; }
public virtual Resource Resource { get; set; }
public Int32 ActivityId { get; set; }
public virtual Activity Activity { get; set; }
public Int32 RoleId { get; set; }
public Role Role { get; set; }
}
// User-Role relationship cardinality is many to many:
protected override void Seed(AppDbContext context) {
// define roles
var role = new Role("SimpleUser");
var roleAdvanced = new Role("AdvancedUser");
// define activities
var readActivity = new Activity("Read");
var updateActivity = new Activity("Update");
var deleteActivity = new Activity("Delete");
var manageActivity = new Activity("Manage");