Get the named anchor from the URL?

  • Thread starter Greg Collins [Microsoft MVP]
  • Start date
B

bruce barker \(sqlwork.com\)

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?
 
A

apathetic

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
 
G

Greg Collins [Microsoft MVP]

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top