It's as simple as doing:
Uri myUri = new Uri("http://www.example.com?param1=good¶m2=bad");
string param1 = HttpUtility.ParseQueryString(myUri.Query).Get("param1");
With that you would get the value of param1
for the example URL proposed.
To use the above method you should do: using System.Web;
In your case it would be applied in the following way:
string Strings = "http://alianzas.qapaq.pe/PlataformaGestion/Gestion/?ref=Affiliate_AskRobin&VariableR=853199";
Uri theUri = new Uri(Strings);
string paramValue = HttpUtility.ParseQueryString(theUri.Query).Get("VariableR");
If you want to do it a little more generic, you can make it a method:
public static string GetParameterFromUrl(string url, string paramname)
{
return HttpUtility.ParseQueryString((new Uri(url)).Query).Get(paramname) ?? null;
}
And you would call it this way:
string Strings = "http://alianzas.qapaq.pe/PlataformaGestion/Gestion/?ref=Affiliate_AskRobin&VariableR=853199";
string VariableR = GetParameterFromUrl(Strings, "VariableR");
Useful links: