Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Custom route go to home controller in addition to correct controller


I've got a route which reponds to searchkeyword and page on a url e.g.


will go to the search page, search for the searchkeyword and display the 2nd page of results. I've used the following route

                name: "Search",
                url: "{language}/{node}/{searchTerm}/{page}/{action}",
                        controller = "Search",
                        action = "Index",
                        searchTerm = UrlParameter.Optional,
                        page = UrlParameter.Optional

    but every time I go to a page it will also fire up the index method on the home controller. The home controlle ris nothing special other than it servers out the root page of the site.

Does anyome know why it is doing that and how I can stop it

Many Thanks for any all help


Feb 04, 2014 14:01


I had the same problem. I my case I solved it by making sure that the Index methods in the controller reflected that searchTerm and page parameters are both optional. Typically:

// search page - no query
public ActionResult Index(SearchPage currentPage) 

// search query with query
public ActionResult Index(SearchPage currentPage, string searchTerm, int? page)


Feb 04, 2014 15:21

Thanks for your comment. Unfortunately both the searchTerm and page are optional so that hasn't corrected the issue.

Thank you though

Feb 05, 2014 12:10

Actually sorted this out. The home controller request was caused by a request to the favicon. Add this to the routing init module causes this to be igonore. Problem goes away

routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });


Feb 06, 2014 14:09
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.