重定向不起作用 [英] Redirects not working

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

问题描述

以下示例是我们正在尝试的重定向.
第一个,用于用户登录,有效,此后,没有重定向有效.
我不知道可能是什么原因,也尝试过redirecttoroute,就像服务器未发送标头或其他任何内容一样.
我没有任何嗅探软件可以检查出来.

UrlHelper uH =新的UrlHelper(新的RequestContext(this.HttpContext,this.RouteData),RouteTable.Routes);
Response.Redirect(uH.Action("TrabalheExperiencia","Contact"),true);
返回this.RedirectToAction("TrabalheExperiencia");
return RedirectToAction("TrabalheExperiencia");

The following examples are redirects wich we''re trying.
The first one, for user login, works, after that no redirect works.
I have no idea about what may be the cause, tried redirecttoroute too, it is like if the server wasn''t sending the headers or anything.
I have no sniffing software to check this out.

UrlHelper uH = new UrlHelper(new RequestContext(this.HttpContext, this.RouteData), RouteTable.Routes);
Response.Redirect(uH.Action("TrabalheExperiencia", "Contact"), true);
return this.RedirectToAction("TrabalheExperiencia");
return RedirectToAction("TrabalheExperiencia");

推荐答案

写道:​​

Response.Redirect (uH.Action("TrabalheExperiencia","Contact"),true);

Response.Redirect(uH.Action("TrabalheExperiencia", "Contact"), true);



这是重定向,您需要在调试器中检查的是uH.Action调用return



This is a redirect, all you need to check in your debugger is what uH.Action calls return

写道:​​

返回this.RedirectToAction("TrabalheExperiencia");
return RedirectToAction("TrabalheExperiencia");

return this.RedirectToAction("TrabalheExperiencia");
return RedirectToAction("TrabalheExperiencia");



这是在调用您添加的方法或您使用的框架.您需要对其进行调试,以弄清为什么它不执行重定向.我假设它应该使用此字符串来计算要访问的页面.我以为您写这本书是因为我无法想象一个框架会犯这样的错误.



This is calling a method added by you or a framework you use. You''d need to debug that to work out why it''s not doing a redirect. I assume it''s supposed to use this string to work out the page to go to. I assume you wrote this because I can''t imagine that a framework would make the mistake of accepting strings like this.


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

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