从视图到另一个视图重定向 [英] Redirect from a view to another view

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

问题描述

您好我想从一个视图到其他视图重定向,但我得到squigly视觉studio.How我可以从一个视图到另一个view.This内部重定向红色是我trye​​d,但它不工作:

Hi I am trying to redirect from a view to a different view but I get a red squigly in visual studio.How can I redirect from inside a view to another view.This is what I have tryed but it does not work:

@Response.Redirect("~/Account/LogIn?returnUrl=Products");

如何从我的观点CURENT到另一个视图重定向?

How can I redirect from my curent view to another view?

推荐答案

这是因为你的语句不产生输出。

It's because your statement does not produce output.

除了达林和懒惰的所有警告(他们是正确的);这个问题仍然offerst可以学到一些东西。

Besides all the warnings of Darin and lazy (they are right); the question still offerst something to learn.

如果您要执行不直接产生输出方式,你做的:

If you want to execute methods that don't directly produce output, you do:

@{ Response.Redirect("~/Account/LogIn?returnUrl=Products");}

这也是如此渲染的谐音,如:

This is also true for rendering partials like:

@{ Html.RenderPartial("_MyPartial"); }

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

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