Get the named anchor from the URL?

  • Thread starter Thread starter Greg Collins [Microsoft MVP]
  • Start date Start date
you don't as the browser does not send the named anchor to the server (it
strips it from the url)

-- bruce (sqlwork.com)


"Greg Collins [Microsoft MVP]" <gcollins_AT_msn_DOT_com> wrote in message
In ASPX, how does one get the named anchor from a URL? Its not in any of the
ServerVariables.

If a url is: http://www.somerandomsite.com/page.aspx#named_anchor

How do I get the value of the named anchor after the # character?
 
bruce said:
you don't as the browser does not send the named anchor to the server (it
strips it from the url)

Ahh, yeah. Bruce is right here, it's a client-side thing. The Uri
class has the Fragment property, but you would need some other way of
getting hold of the full url.

Tim
 
Thanks. I'll check this out.

On a side note, it looks like the named anchor is maintained through a Server.Transfer (even in the case of a custom 404 error page) -- which is pretty cool!
 
Back
Top