Redirecting from cshtml page

前端 未结 4 974
执念已碎
执念已碎 2020-12-18 18:12

I want to redirect to a different view depending on the result of a dataset, but I keep getting returned to the page I am currently on, and can\'t work out why. I drop into

4条回答
  •  时光说笑
    2020-12-18 18:54

    Would be safer to do this.

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

    So the controller for that action runs as well, to populate any model the view needs.

    Source
    Redirect from a view to another view

    Although as @Satpal mentioned, I do recommend you do the redirecting on your controller.

提交回复
热议问题