0

Can any one help me on how to pass parameters along with url, that redirects me to a web page. I have a desktop application. I have a button, once the button is clicked, I need to formulate the url and keyvalue pairs and invoke the webpage.
Im using below code to pass parameters with URL, to open it on the web browser, but I am unabe to render page on the browser.

string URI = "http://localhost:3457/HiddenPageToByPassLogin.aspx";
string myParameters = "param1=value1&param2=value2&param3=value3";

using (WebClient wc = new WebClient())
{
  wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-   urlencoded";

string HtmlResult = wc.UploadString(URI,myParameters);
} 

Can anyone explain me why I am unable to do so? Any help is appreciated

Sunny
  • 3,185
  • 8
  • 34
  • 66
Nik
  • 61
  • 7

2 Answers2

1
   System.Diagnostics.Process.Start("http://google.com");

You can pass data in query string as well

Another Way

ProcessStartInfo startInfo = new ProcessStartInfo("iexplore.exe", "http://www.google.com/");
Process.Start(startInfo); 
Kaushik Thanki
  • 3,334
  • 3
  • 23
  • 50
0

You can pass parameters by using the query string eg.

http://www.somesite.com?param1=123&param2=abc

See also Query String

TheEdge
  • 9,291
  • 15
  • 67
  • 135