title: Optional parameter in ASP.net 4.0 c#
body: <p>I have a website built in ASP.NET 4.0 and currently I have a drop down box with URLs, a button that goes to that URL and parses out text and then finally a results box with the parsed text.</p>
  
  <p>What I want to do is instead of going to my website and choosing the URL in the drop down box, I want to pass on the parameter as a full URL and have the button go to that and then do its thing. Kind of like a permanent link that I can hand to a user</p>
  
  <p>For instance:</p>
  
  <p><a href="http://localhost:62554/WebSite5/Default.aspx" rel="nofollow">http://localhost:62554/WebSite5/Default.aspx</a> --> <a href="http://google.com" rel="nofollow">http://google.com</a></p>
  
  <p>google.com gets put into a variable (lets say its <code>MyURL</code>) and the button takes it just like if it were in the drop down box.
  **Updated code: Now getting a error 500 at </p>
  
  <pre><code>using (StreamReader objReader = new StreamReader(objRequest.GetResponse().GetResponseStream()))
  </code></pre>
  
  <hr>
  
  <pre><code>string newURL;
  String url;
  
  protected void Page_Load(object sender, EventArgs e)
  {
  
      //Request.Params.Get("newURL").ToString();
      //string url = Request["newURL"];
      //url = Request.QueryString["newURL"].ToString();
      url = Request.QueryString["newURL"].ToString();
  
      parseButton_Click(sender, e);
  }
  protected void parseButton_Click(object sender, EventArgs e)
  {
  
      //MyURL = deviceCombo.Text;
      //MyURL = Request.Params.Get("");
      //MyURL = Request.Params.Get("newURL");
      //MyURL = newURL;
      //string MyURL = Request.Params["newURL"].ToString();
  
      WebRequest objRequest = HttpWebRequest.Create(url);
      objRequest.Credentials = CredentialCache.DefaultCredentials;
      using (StreamReader objReader = new StreamReader(objRequest.GetResponse().GetResponseStream()))
      {
          originalText.Text = objReader.ReadToEnd();
      }
  
      //Read all lines of file
      String[] crString = { "&lt;BR&gt;&amp;nbsp;" };
      String[] aLines = originalText.Text.Split(crString, StringSplitOptions.RemoveEmptyEntries);
      String noHtml = String.Empty;
  
      for (int x = 0; x &lt; aLines.Length; x++)
      {
          if (aLines[x].Contains(filterCombo.SelectedValue))
          {
              noHtml += (RemoveHTML(aLines[x]) + "\r\n");
  
          }
      }
  
      //Print results to textbox
      resultsBox.Text = String.Join(Environment.NewLine, noHtml);
  }
  </code></pre>
  
  <p>Any ideas? Thank you</p>