asp.net mvc ajax post - redirecttoaction not working

前端 未结 2 850
南旧
南旧 2020-12-18 05:42

I used the following code in one of my controller;

            if (Request.IsAjaxRequest()) {
            return RedirectToAction(\"PreviewAndSendEmail\");
          


        
2条回答
  •  隐瞒了意图╮
    2020-12-18 06:26

    You can't redirect in an AJAX action from the server. If you want your browser to redirect in an AJAX action you need to do it from javascript. Obviously using AJAX to redirect is absolutely useless. If you intend to redirect use a normal Html.Begin form and don't bother with AJAX.

提交回复
热议问题