Reputation: 1357
I wanted to get the following data from the url
- the service name which is in this case - customer
2.client which is 177
the structure is the the same always and the name of the service and client can be changed
Uri uri = new Uri("https://ldcorp:435/mtp/op/ota/ind/Customer/?my-client=177");
Upvotes: 2
Views: 99
Reputation: 10968
uri.Segments.LastOrDefault()
returns "Customer/"
uri.Query
returns "?my-client=177"
You can use HttpUtility.ParseQueryString (System.Web assembly) to parse the query.
var result = HttpUtility.ParseQueryString(uri.Query);
string client = result["my-client"];
Upvotes: 4