从jsonresult返回类型方法重定向 [英] redirecting from jsonresult return type method

查看:102
本文介绍了从jsonresult返回类型方法重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友请引导我

我有这样的功能

hi friends plz guide me

i have a function like this

public JsonResult test()
{
  if(1)
   {
return RedirectToAction("actionmethod","controllename");//this is not working

   }
  else
  {
  return json();
   }

}



我想从此方法重定向到另一个视图



i want to redirect to another view from this method

推荐答案

您需要返回更通用的"ActionResult",该结果将同时重定向到result和json结果源自.
You need to return the more generic ''ActionResult'', which a redirect to result and a json result both derive from.


这篇关于从jsonresult返回类型方法重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆