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?

2

3 Answers 3

6

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

Sign up to request clarification or add additional context in comments.

3 Comments

Nitpick: It's called Fragment Identifier, not "hash value". :-)
Well you access it with location.hash so that's why I called it that, my bad ;)
thanks everyone, you all had it right, wish i could award multiples
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.

1 Comment

thanks everyone, you all had it right, wish i could award multiples
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.

4 Comments

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?
Yes. That should be easy using a jquery script.
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
Sure! jQuery takes some getting used to so you should read the getting started intro here: docs.jquery.com/Tutorials:Getting_Started_with_jQuery Then you may want to look at this jQuery add on for url parsing: projects.allmarkedup.com/jquery_url_parser

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.