I want to block partialview url via url using [ChildActionOnly]
.
Issue problem, follow code:
HTML:
<li style="cursor:pointer"><a id="button_id">Criar</a></li>
JS:
$("#button_id").click(function () {
$("#conteudoModal").load("@Url.Action("MinhaAcao", "Controller")", function () {
$('#minhaModal').modal('show');
});
});
Controller:
[HttpGet]
[ChildActionOnly] // <----- Aqui
public ActionResult MinhaAcao()
{
var model = new Model();
return PartialView(model);
}
Without [ChildActionOnly]
modal opens normal and with partialview url.
With [ChildActionOnly]
, when I click the "Create" button, I get error message:
Exception Details: System.InvalidOperationException: The action 'MyAction' is only accessible for a daughter request.
Any solution?