0

I use Request.QueryString["var"] to pull the value of http://test.com/test.aspx?var=test into a string

the same thing doesn't work for test.aspx#var=test

how can I get it from that version of a querystring?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
korben
  • 39
  • 1
  • 7

3 Answers3

6

The Fragment Identifier (#) is client-side only, you can't get that from server side code.

Shawn Steward
  • 6,773
  • 3
  • 24
  • 45
1

#var=test is not q query string. That's part of the "URL Fragment". In a URL to a web page, it indicates which <a> tag to go to.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
0

I don't think the part of the url after the # is passed to the web server directly. To access it you would need to do some javascript processing to pass it on.

Rune Grimstad
  • 35,612
  • 10
  • 61
  • 76
  • oh i see, i'm trying to set the div style properties of a block differently depending on what's in that #var variable, javascript would be the way to go instead you think? – korben May 19 '10 at 21:13
  • Yes. That should be easy using a jquery script. – Rune Grimstad May 19 '10 at 21:14
  • ok i guess i'll go look for one, never used jquery i'm a novice. if you have time and care to link me to something relevant that'd be awesome, otherwise thanks – korben May 19 '10 at 21:17
  • Sure! jQuery takes some getting used to so you should read the getting started intro here: http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery Then you may want to look at this jQuery add on for url parsing: http://projects.allmarkedup.com/jquery_url_parser/ – Rune Grimstad May 19 '10 at 21:21