I have a cshtml view in an MVC ASP.NET application. I want to simply allow the user to click a button and provide a warning to the user before the action is carried out. The only way I know to acheive what I want is to use an AjaxActionLink
like so
<a role="button"
class="btn btn-lg btn-primary"
href='@Ajax.ActionLink(
"Clear Invite Log",
"ClearInviteLog",
"Tools",
null,
new AjaxOptions { HttpMethod = "GET" },
new { onclick = "return confirm('Are you sure you want to clear the invite log?');" })'>
Clear Invite Log
</a>
Where the name of my controller is ToolsController
and the method I am posting to is ClearInviteLog
. The problem is that when I click the button I don't get the warning dialog, instead I get
Server Error in '/' Application. A potentially dangerous Request.Path value was detected from the client (<).
Stack Trace: [HttpException (0x80004005): A potentially dangerous Request.Path value was detected from the client (<).] System.Web.HttpRequest.ValidateInputIfRequiredByConfig() +9693412 System.Web.PipelineStepManager.ValidateHelper(HttpContext context) +53
I am new to web development and I am confused. What I am doing wrong here?
Thanks for your time.