title: Remove characters after specific character in string, then remove substring?
body: <p>I feel kind of dumb posting this when this seems kind of simple and there are tons of questions on strings/characters/regex, but I couldn't find quite what I needed (except in another language: <a href="https://stackoverflow.com/questions/2176544/remove-all-text-after-certain-point">Remove All Text After Certain Point</a>).</p>
  
  <p>I've got the following code:</p>
  
  <pre><code>[Test]
      public void stringManipulation()
      {
          String filename = "testpage.aspx";
          String currentFullUrl = "http://localhost:2000/somefolder/myrep/test.aspx?q=qvalue";
          String fullUrlWithoutQueryString = currentFullUrl.Replace("?.*", "");
          String urlWithoutPageName = fullUrlWithoutQueryString.Remove(fullUrlWithoutQueryString.Length - filename.Length);
  
          String expected = "http://localhost:2000/somefolder/myrep/";
          String actual = urlWithoutPageName;
          Assert.AreEqual(expected, actual);
      }
  </code></pre>
  
  <p>I tried the solution in the question above (hoping the syntax would be the same!) but nope. I want to first remove the queryString which could be any variable length, then remove the page name, which again could be any length.</p>
  
  <p>How can I get the remove the query string from the full URL such that this test passes?</p>