title: How to modify query string in Controller before returning View
body: <p>Is there a way to modify the query string/URL parameters for a request in ASP.NET MVC 4 Controller before returning the view? I want to append a parameter to the URL.</p>
  <p>I tried adding a key to the <code>Request.QueryString</code> dictionary, but it seems to be read-only.</p>
  <hr />
  <p>Additional context information:</p>
  <p>I have an ASP.NET MVC 4 page where the user can create an event in a calendar view. When the user clicks the &quot;Create event&quot; button, the system creates a pending reservation for the event. The user is then redirected to an &quot;Edit event&quot; view. The actual calendar event is created over the pending reservation when the user has filled the &quot;Edit event&quot; page and submits.</p>
  <p>My problem is that I don't want to create a new pending reservation every time the &quot;Edit event&quot; page is loaded (e.g. refreshing with F5). Thus, I came up with the idea to add the newly-created pending reservation Id to the query string. This way every consecutive page-load will use the existing pending reservation.</p>
  <p>However, it doesn't seem to be possible to edit the query string in the Controller. Is there an alternative way to do this?</p>
  <pre><code>public ActionResult CreateEvent()
  {
      var model = new CalendarEventEditModel();
  
      //This should be true for the first time, but false for any consecutive requests
      if (Request.QueryString[&quot;pendingReservationId&quot;] == null)
      {
          model.PendingReservationId = _calendarService.CreatePendingReservation();
          //The following line throws an exception because QueryString is read-only
          Request.QueryString[&quot;pendingReservationId&quot;] = model.PendingReservationId.ToString();
      }
  
      return View(&quot;EditEvent&quot;, model);
  }
  </code></pre>
  <p>Also any suggestions regarding the overall functionality are appreciated.</p>