如何重定向到下一页 [英] How do I redirect to next page

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

问题描述

  if (obj1>  0 

return RedirectToAction( http://本地主机:53500 /第1页/索引);

else
return RedirectToAction( 登录 登录);







如果条件满足我想重定向到网址中提到的页面。

我写了上面的代码但没有工作..

请帮助

解决方案

< blockquote> RedirectToAction接受操作名称和控制器名称。如果您想分配Url,请给出指定的Action和Controller,即从您的代码中获取

return RedirectToAction(Index,page1)

谢谢


RedirectToAction方法有不同类型的表单,需要1到6种类型的参数,具体取决于我们需要使用合适的表格。



这里你可以使用RedirectToAction和两个参数方法,两个都是字符串类型参数。第一个参数是动作名称,第二个是控制器名称,如下所示



返回RedirectToAction(ActionName,ControllerName); 







更多信息请查看以下链接

http:// msdn。 microsoft.com/en-us/library/system.web.mvc.contr oller.redirecttoaction(v = vs.118).aspx [ ^ ] [ ^ ]



谢谢,

--RG


if (obj1 > 0)

                return RedirectToAction("http://localhost:53500/page1/index");

            else
                return RedirectToAction("Login", "Login");




if condition is satisfied I want to redirect to the page mentioned in the url.
I had written the above code but not working..
Please help

解决方案

RedirectToAction accepts Action name and controller name. If you want to assign the Url the give the specified Action and Controller i.e. from your code
return RedirectToAction("Index","page1")
Thanks


RedirectToAction method has different types of forms it takes 1 to 6 types of arguments depending upon our requirement we need to use suitable form.

Here you can use RedirectToAction with two parameters method, both are string type parameters.First parameter is Action name and second is Controller name as below

return RedirectToAction("ActionName", "ControllerName");




More information please go through the below link
http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.redirecttoaction(v=vs.118).aspx[^][^]

Thanks,
--RG


这篇关于如何重定向到下一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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