Asp.net MVC putting # in the url

1.3k views Asked by At

We are using Asp.net MVC, one of our requirement is to put '#' in the url something like www.xyz.com/a-to-b/#date i have registered the route below, it works fine for 'to' in the url but using # before the date i get a null data back. Is '#' some special character and required a different treatment.??

routes.MapRoute(
            "routename",
            "{origin}-to-{destination}/#{outDate}",
            new
                {
                    controller = "Home", 
                    action = "ActionName", 
                });
1

There are 1 answers

0
zihotki On

The hash value (string starting from #) will never be sent to server. If you need access to the hash value you can use the following approach - How to get Url Hash (#) from server side .
Also it seems to me that you need to implement some kind of ajax navigation with history support. If I'm right then check this article - http://stephenwalther.com/blog/archive/2010/04/08/jquery-asp.net-and-browser-history.aspx