Skip to content

Instantly share code, notes, and snippets.

View Maarten88's full-sized avatar

Maarten Sikkema Maarten88

View GitHub Profile
@Maarten88
Maarten88 / AccountController.ExternalLoginCallback.cs
Last active December 18, 2015 09:29
Amazon OAuth2 Client for DotNetOpenAuth
...
//
// GET: /Account/ExternalLoginCallback
[AllowAnonymous]
public ActionResult ExternalLoginCallback(string returnUrl)
{
// Hack around DotNetOpenAuth and OAuth providers using the returnUrl for things that are in the state parameter (Amazon, Google)
// Our provider passed the querystring part of the replay address into the state field
// On return we parse that state parameter and put the arguments back where DotNetOpenAuth expects them, than redirect back to ourselves
if (!String.IsNullOrEmpty(Request.QueryString["state"]))
@Maarten88
Maarten88 / CookieConsentAttribute.cs
Last active March 27, 2023 21:33
ASP.NET ActionFilterAttribute to help implement european cookie-law
/*
* ASP.NET ActionFilterAttribute to help implement EU Cookie-law
* MIT Licence (c) Maarten Sikkema, Macaw Nederland BV
*/
using System;
using System.Web;
using System.Web.Mvc;
namespace Auction.Web.Utility
using Auction.Web.Utility;
using System.Web.Mvc;
namespace Auction.Web.Controllers
{
[CookieConsent]
public class HomeController : Controller
{
public ActionResult Index()
{
@using Auction.Web.Utility
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>@ViewBag.Title - My ASP.NET MVC Application</title>
@RenderSection("meta", false)
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="~/Content/less/bootstrap.less" rel="stylesheet">
using Auction.Web.Utility;
using System.Web.Mvc;
namespace Auction.Web.Controllers
{
[AllowAnonymous]
public class SiteController : BaseController
{
public ActionResult AllowCookies(string ReturnUrl)
{
@Maarten88
Maarten88 / _Layout.cshtml
Created June 17, 2013 09:09
Setting up an ASP.NET MVC4 solution with Twitter Bootstrap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>@ViewBag.Title - My ASP.NET MVC Application</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="~/Content/less/bootstrap.less" rel="stylesheet">
<style type="text/css" >
body {
@{
Layout = null;
}
<html>
<body>
<script type="text/javascript" src="//connect.facebook.net/@(System.Globalization.CultureInfo.CurrentCulture.ToString().Replace("-", "_"))/all.js"></script>
</body>
</html>
using System;
using System.Web.Mvc;
using System.Web.WebPages;
namespace Auction.Web.Areas.Facebook
{
public class FacebookAreaRegistration : AreaRegistration
{
public override string AreaName
{
namespace Auction.Web.Areas.Facebook.Controllers
{
public class HomeController : Auction.Web.Controllers.HomeController
{
}
}
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;