1

I am looking to standardize the processing of ajax #anchors at the server side, using MVC.

Before a controller action is invoked I want to convert every request with ajax anchors into a request without ajax anchors, so that the controller code does not know there were anchors in the request:

For example:

1) /user/profile#user/photos should be treated as /user/photos

2) /main/index#user/profile/33 should be treated as /user/profile/33

What is the best technique in MVC to accomplish that?

Josh Lee
  • 171,072
  • 38
  • 269
  • 275
Andy
  • 2,670
  • 3
  • 30
  • 49
  • 1
    Are you sure this even happens? http://www.mikeduncan.com/named-anchors-are-not-sent/ – John Farrell Jul 24 '10 at 03:31
  • emmm... just realized this myself when started writing the code. Neeed to have some javascript preprocessing, to send the anchor info to the server manually. – Andy Jul 24 '10 at 03:58

1 Answers1

1

Anchors are not pushed to the server with the url. One option would be to put the value /main/index#user/profile/33 inside a hidden field and get the contents of this from your controller.

However I am not sure how you are using the anchors within the markup page so this may not help!

Rippo
  • 22,117
  • 14
  • 78
  • 117