How to read Hash Parameters in Url [duplicate]

2019-09-18 02:29发布

问题:

Possible Duplicate:
How to get Url Hash (#) from server side

I have hash parameters in url

Can any body please help me to how to read Hash parameters value from Url using C#?

www.example.com/default.aspx#!type=1

How to read value of type?

回答1:

The hash part is only used and available on the client. You cannot read it from ASP.NET / C#.



回答2:

  1. Split the URL at the hash (#).
  2. Then split the second element from above at each ampersand (&)
  3. Then split each of those at the equals (=) sign.

You will then have all the parameters and values.


If this was asking about a ASP.net application, you want to use Request.QueryString["type"] to get the value.



标签: c# url