开发者

Redirect to action and return View instead of Ajax Result

I implemented filter, which should redirect me to one page if some conditions aren't true, But this filter don't work with Ajax Requests, after redirect, javascript capture result and put whole View into html element.

How can i Stop p开发者_运维百科rocessing ajax request and redirect it to normal http request??

Thx in advance,


1) Wrote function in Javascript which do redirect:

ClientRedirect(url)
{
   document.location = url;
}

2) return javascript code, something like:

<script>ClientRedirect("path to desired action");</script>

It will get executed and will perform redirect


Afaik, you can't do it server side. You can use something like

window.location.href = 'MyController/MyAction/params';

to redirect in your javascript function which processes the response.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜