c# - Is there a simple way to get query string parameters from a URI in Windows Phone? -
i'm working custom uri scheme validate users using oauth. in order this, need values of parameters query string.
is there simple way information? or option using regex or other string manipulation?
i have found references things parsequerystring, these contained in libraries not available on windows phone.
after lot of searching landed on simple approach. long query strings kept simple (as in oauth) method should work.
public static dictionary<string, string> parsequerystring( string uri ) { string substring = uri.substring( ( ( uri.lastindexof('?') == -1 ) ? 0 : uri.lastindexof('?') + 1 ) ); string[] pairs = substring.split( '&' ); dictionary<string,string> output = new dictionary<string,string>(); foreach( string piece in pairs ){ string[] pair = piece.split( '=' ); output.add( pair[0], pair[1] ); } return output; }
Comments
Post a Comment