. NET to Get the parameter key value in the Get URL,. netget
In Web development, we often need to obtain the parameter key values in the Get URL. Here we will briefly introduce three methods:
First, you can use JavaScript to obtain location. href and use a regular expression to match all key-value pairs of the URL;
Type 2: for example, if a Key parameter Key exists, you must obtain the corresponding value. request. NET. form ["Key"] (for Post) or Request. queryString ["Key"] (for Get), you can also use Request ["Key"] (either Post or Get)
In fact, there is another way of. NET, that is, to convert the obtained URL address into a NameValueCollection object, for example:
1 using System. Web; 2 using System. Collections. Specialized; 3 4 NameValueCollection collection = HttpUtility. ParseQueryString ("? ProjectID =-1 & ProID =-1 & CurId = 503 & IsTender = Y & PlanID =-1 & hasAccess = True & mode = v "); 5 string hasAccess = collection. get ("hasAccess"); // "True"