title: ASP.Net MVC: Passing a string parameter to an action using RedirectToAction()
body: <p>I would like to know how to pass a string parameter using RedirectToAction().</p>
  
  <p>Let's say I have this route:</p>
  
  <pre><code>routes.MapRoute(
    "MyRoute",
    "SomeController/SomeAction/{id}/{MyString}",
    new { controller = "SomeController", action = "SomeAction", id = 0, MyString = UrlParameter.Optional }
  );
  </code></pre>
  
  <p>And in SomeController, I have an action doing a redirection as follows:</p>
  
  <pre><code>return RedirectToAction( "SomeAction", new { id = 23, MyString = someString } );
  </code></pre>
  
  <p>I tried this redirection with someString = "!@#$%?&amp;* 1" and it always fails, no matter if I encode the string. I tried encoding it with HttpUtility.UrlEncode(someString), HttpUtility.UrlPathEncode(someString), and with Uri.EscapeUriString(someString) to no avail.</p>
  
  <p>So I resorted to us TempData to pass someString, but still, I would be curious to know how to make the code above work, just to satisfy my curiosity.</p>