Sorry. I've been missing you're point about your problem being specifically with #.
The fact is that starting with # and anything after that doesn't get passed to the server.
That's used by the browsers to jump to a specified anchor. Server-side, you can't use as it doesn't get picked up.