idm
idm

Reputation: 1748

ASP.NET: parse url having # (hash) sign

I need to parse url that has something after # (hash) sign in my asp.net application. How to do it easily? Thank you,

Upvotes: 0

Views: 3237

Answers (4)

TAN克
TAN克

Reputation: 11

This is called "hash sign" URI. After client gets PAGE responsed including js, the contents after '#' would be handled by client using responsed js to get "real" URL for redirection. SEE: https://www.w3.org/2001/tag/2011/01/HashInURI-20110115#References

Upvotes: 1

idm
idm

Reputation: 1748

Omg, I meant fragment (after #) part on the server... Though I've looked thrugh and found that it seems to be impossible......

Upvotes: 0

Aaron J Spetner
Aaron J Spetner

Reputation: 2155

url.Substring(url.IndexOf('#') + 1)

...where "url" is a string containing the url in question

Upvotes: 1

SLaks
SLaks

Reputation: 887657

You're looking for the Uri class:

new Uri(someString).Fragment

Note that the hash is not sent to the server in an HTTP request.

Upvotes: 2

Related Questions