Skip to content

Instantly share code, notes, and snippets.

View AniAko's full-sized avatar
🎯
Focusing

Coop AniAko

🎯
Focusing
View GitHub Profile
@AniAko
AniAko / gist:3f955b5ad9a71f17635e
Last active April 3, 2019 13:43 — forked from frankgeerlings/gist:1711560
An update on https://gist.github.com/frankgeerlings/1711560 MVC doesn't like the missing trailing slash on the URI authority (empty path), it's against HTTP/1.1 requirements as well it seems.
// Put this in Global.asax.cs
protected void Application_BeginRequest(object sender, EventArgs e)
{
// Do Not Allow URL to end in trailing slash
string url = HttpContext.Current.Request.Url.AbsolutePath;
if (string.IsNullOrEmpty(url)
|| url.Trim() == "/"
|| url.Trim() == "\\") return;