[英]MVC RedirectPermanent to another domain ends in infinite loop
Can someone see what I'm doing wrong here. 有人可以在这里看到我做错了吗。 I Would expect it to redirect me to http:\\www.google.com but instead I end up in a loop.
我希望它会将我重定向到http:\\ www.google.com,但最终会陷入循环。
public ActionResult Index()
{
var redirecturl = string.Format("http:\\www.google.com");
return RedirectPermanent(redirecturl);
}
Just if you need it, here is my Routes. 只要您需要,这就是我的路线。
routes.MapRoute(
"Default", // Route name
"{*url}", // URL with parameters
new { controller = "Redirect", action = "Index"} // Parameter defaults
);
I end up with an url like this http://localhost:20000/google.com and an error Error 310 (net::ERR_TOO_MANY_REDIRECTS):
我最终得到一个像这样的网址http:// localhost:20000 / google.com和
Error 310 (net::ERR_TOO_MANY_REDIRECTS):
This is a small example I created, I want to end up with a small mvc site, that responce to all url, create a log entry and then do a permanent redirect to another domain (301). 这是我创建的一个小示例,我想创建一个小型mvc站点,该站点响应所有url,创建日志条目,然后永久重定向到另一个域(301)。
Try redirect to http://www.google.com not http:\\www.google.com 尝试重定向到http://www.google.com而不是http:\\ www.google.com
as you can see the first is a link while the second isn't 如您所见,第一个是链接,而第二个则不是
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.