I have a controller action that is being executed by a link that was created using 'Ajax.ActionLink()' the problem is that I can't tell in my action that the request is an AJAX request because Request.IsMvcAjaxRequest()
is always returning false.
Does Request.IsMvcAjaxRequest()
not work with Ajax.ActionLink()
generated requests?
Here is the code I am using to generate my link:
<%= Ajax.ActionLink("Delete", "Delete", new { graphUri = ViewData.Model.Uri.Value }, new AjaxOptions { Confirm = "Really delete?", OnSuccess = "success", OnFailure = "fail", HttpMethod = "DELETE" }, new { title = "Delete Graph", @class = "deleteGraphLink" })%>
When I look at the code for the IsMvcAjaxRequest
extension method it looks like it will only work for AJAX Forms and not for AJAX ActionLinks.
Update 11/13
If I change the HttpMethod in the AjaxOptions to POST, all is well. Anyone know how to get Request.IsMvcAjaxRequest() to work properly when you are using the DELETE method?