Get the named anchor from the URL?

Discussion in 'ASP .Net' started by Greg Collins [Microsoft MVP], Oct 11, 2006.

  1. Greg Collins [Microsoft MVP], Oct 11, 2006
    #1
    1. Advertising

  2. 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
    news:...
    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?

    --
    Greg Collins [Microsoft MVP]
    Visit Brain Trove ( http://www.BrainTrove.com )
     
    bruce barker \(sqlwork.com\), Oct 11, 2006
    #2
    1. Advertising

  3. Greg Collins [Microsoft MVP]

    apathetic Guest

    apathetic, Oct 11, 2006
    #3
  4. Greg Collins [Microsoft MVP]

    apathetic Guest

    bruce barker (sqlwork.com) wrote:
    > 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
     
    apathetic, Oct 12, 2006
    #4
  5. uriAddress.Fragment retrieves the URL's anchor, if it exists.





    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ===================================
    "bruce barker (sqlwork.com)" <> wrote in message
    news:...
    > 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
    > news:...
    > 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?
    > --
    > Greg Collins [Microsoft MVP]
     
    Juan T. Llibre, Oct 12, 2006
    #5
  6. re:
    > Ahh, yeah. Bruce is right here, it's a client-side thing.


    I was wrong, too. Mea culpa.




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ===================================
    "apathetic" <> wrote in message
    news:...
    > bruce barker (sqlwork.com) wrote:
    >> 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
    >
     
    Juan T. Llibre, Oct 12, 2006
    #6
  7. 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!

    --
    Greg Collins [Microsoft MVP]
    Visit Brain Trove ( http://www.BrainTrove.com )
     
    Greg Collins [Microsoft MVP], Oct 12, 2006
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nalaka

    named anchor

    Nalaka, Dec 23, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    565
    Steven Cheng[MSFT]
    Dec 29, 2005
  2. Mark Parnell

    Named anchor question

    Mark Parnell, Jun 28, 2005, in forum: HTML
    Replies:
    3
    Views:
    592
    Ian Rastall
    Jun 28, 2005
  3. Replies:
    1
    Views:
    540
  4. Robert Mark Bram

    Jump to named anchor after form processing

    Robert Mark Bram, Oct 20, 2004, in forum: ASP General
    Replies:
    3
    Views:
    208
    Evertjan.
    Oct 21, 2004
  5. John
    Replies:
    1
    Views:
    106
    Lasse Reichstein Nielsen
    Aug 2, 2003
Loading...

Share This Page