2

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", 
                });
Miral
  • 5,968
  • 16
  • 57
  • 85
  • Have you tried adding %23 instead of a # ? – dubs Mar 02 '11 at 10:24
  • Just want to add '#' for the SEO purpose. i just want google to index the url which is before the # and ignore everything else after # – Miral Mar 02 '11 at 16:07

1 Answers1

1

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

Community
  • 1
  • 1
zihotki
  • 5,201
  • 22
  • 26