我有一个symfony2Controller,我想在其中执行以下操作:try{return$this->redirect($request->headers->get('referer'));}catch(Exception$e){return$this->redirectToRoute('home');}它不起作用。这个想法是考虑到这个Controller中发生的事情,用户的权限可能会改变。所以我想知道他是否还可以访问当前路由,如果可以,则重定向到当前路由,如果不能,则重定向到家。我该怎么做?非常感谢! 最佳答案 我没有找到一个好
所以我有我的域-www.mycatchyname.com,它基本上是一个有一个目的的单页站点,所以我在根Controller/操作上使用RedirectToRoute直接转到www.mycatchyname.com/seo-关键词。所以www.mycatchyname.com/seo-keyword基本上就是主页。Google如何看待这一点?搜索我的网站实际内容的人可能会在结果中选择www.mycatchyname.com/seo-keyword,但是有些人会直接访问www.mycatchyname.com。这两个实例都会被索引并在结果页面上有单独的pageranks/条目吗?Redi
在我的网页1Controller中,我想重定向到网页2,传递2个变量。我尝试使用RedirectToRoute,但无法正常工作;显示错误的URL。然后我改用RedirectToAction。我的代码:路由routes.MapRoute("CreateAdditionalPreviousNames",//Routename"Users/{controller}/{action}/{userId}/{applicantId}",//URLwithparametersnew{controller="UsersAdditionalPreviousNames",action="Index",us