Created
January 23, 2013 19:43
-
-
Save emiaj/4612092 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class RequestDataHelper | |
| { | |
| [MarkedForTermination("Use FubuMVC.Core.AjaxExtensions.IsAjaxRequest when updating FubuMVC.Core to latest or kill this when support for IE7 gets dropped.")] | |
| public static bool IsAjaxRequest(IRequestData requestData) | |
| { | |
| var result = false; | |
| requestData.Value(AjaxExtensions.XRequestedWithHeader, delegate(BindingValue value) | |
| { | |
| result = value.RawValue.isAjaxRequest(); | |
| }); | |
| if(!result) | |
| { | |
| requestData.Value(AjaxExtensions.XRequestedWithHeader.ToLowerInvariant(), delegate(BindingValue value) | |
| { | |
| result = value.RawValue.isAjaxRequest(); | |
| }); | |
| } | |
| return result; | |
| } | |
| private static bool isAjaxRequest(this object value) | |
| { | |
| return AjaxExtensions.XmlHttpRequestValue.Equals(value as string, StringComparison.InvariantCultureIgnoreCase); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment