tags:

views:

464

answers:

2

I am trying to implement ajax back/forward button support and therefore writing variables after a # in my url. I would also like the user to be able to copy the url and then link back to it. Does anyone know how can I parse the url and grab my "querystrings" even though they are behind a #?

+11  A: 

The value after the hash is not transmitted to the server. There's another SO question about that somewhere, but I'm having trouble finding it. Likewise it's taken me a while to find a decent reference to cite, but this Wikipedia article has some confirmation:

The fragment identifier functions differently than the rest of the URI: namely, its processing is exclusively client-side with no participation from the server. When an agent (such as a Web browser) requests a resource from a Web server, the agent sends the URI to the server, but does not send the fragment.

I assume you want to respond to it on the server side rather than the browser side? (Given that you're asking about doing it in C#...)

Jon Skeet
+1 I didn't know the server doesn't receive it (bummer)
orip