重定向循环错误路由asp.net 4.0 webforms

问题描述:

大家好,

当我点击应该打开另一个路由链接的链接时,我在路由页面中收到错误,但似乎代码生成了一个我不明白的循环为什么以及在哪里。



这里是global.asax中的代码

Hi guys,
I am getting an error in a routed page when I click on a link that should open another routed link, but it seems that the code makes a loop I don't understand why and where.

Here the code in the global.asax

Sub RegisterRoutes(ByVal routeCollection As RouteCollection)
       RouteTable.Routes.RouteExistingFiles = false
       routeCollection.Ignore("{resource}.axd/{*pathInfo}")
       routeCollection.MapPageRoute("RouteHome", "", "~/home.aspx")

       routeCollection.MapPageRoute("RouteForpage", "search/{typology}/", "~/search-by-typology.aspx", False,
                                    New RouteValueDictionary(New With {.typology = ""}))



       routeCollection.MapPageRoute("RouteArticle", "search/{articlecode}/{id}/", "~/article.aspx")
End Sub





in murkup(s earch-by-typology.aspx)我添加了以下代码





in the murkup(search-by-typology.aspx) I added the following code

<a href='<%# GetRouteUrl("RouteArticle", new With {.articlecode= eval("articlecodeDB").tostring(), .id = eval("idDB").tostring() })  %>'>	view details </a><br />





当我点击链接时出现重定向循环错误,请执行你有什么建议吗?



谢谢



When I click on the link I get the redirection loop error, do you have any suggestion?

thank you

我是从
search-by-typology.aspx

article.aspx

但在文章的代码隐藏中,我有一个response.redirect(按类型搜索。 aspx)旧样式重定向,它回去了,所以当我评论该行时问题消失了。

我希望这能帮到别人。



感谢您的评论



Fra

but in the article's codebihind I have got a response.redirect(search-by-typology.aspx) old style redirect and it was going back so when I have commented that row the issue disappeared.
I hope this help someone else.

Thank you for your comment

Fra