Skip to content

Instantly share code, notes, and snippets.

View mdbench's full-sized avatar
🟢
is online

Matthew Benchimol mdbench

🟢
is online
View GitHub Profile
@joshka
joshka / Global.asax.cs
Created October 14, 2014 05:56
HTTP -> HTTPS redirect and add HSTS header
// ...
protected void Application_BeginRequest(object sender, EventArgs e)
{
switch (Request.Url.Scheme)
{
case "http":
RedirectToHttps();
break;
case "https":
AddStsHeader();