Miral
Miral

Reputation: 6038

Asp.net MVC putting # in the url

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", 
                });

Upvotes: 2

Views: 1375

Answers (1)

zihotki
zihotki

Reputation: 5191

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

Upvotes: 1

Related Questions