Note that there are some explanatory texts on larger screens.

plurals
  1. POPost Redirect Get Hide URL Parameters
    primarykey
    data
    text
    <p>Let me try to set the scenario here first. This is done using ASP.NET 4.0, MVC3, and C#.</p> <p>I have a picture gallery. I have a manager for the albums in the picture gallery. Each gallery has a set of pages.</p> <p>When I am using the manager for the albums, the view shows a list of current albums.</p> <p>In the list of albums, there are choices to edit, delete, or manage pages in that album.</p> <p>When selecting to manage the pages for the album, there is a list of pages, each with edit, delete, and view.</p> <p>When the edit button for the page is selected, and edits are made then saved, my problem is encountered.</p> <p>The button to get to the list of pages to manage from the list of albums sends the id via post to hide the albumid and other parameters.</p> <p>So the view for the pages is generated from a [HttpPost] controller. Then, from the view to manage pages, when the edit button is clicked, the page for edit is generated from a [HttpPost] controller for the same reason (to hide parameters). </p> <p>Here is the problem: Once the save button is clicked in the edit view, data is posted to a save changes controller via [HttpPost], but I do not want to return the edit view (refresh would repost changes and it is not really best practice). I want to return to the list of pages for the selected album. In doing this, I am using [HttpPost] from the edit controller to redirect back to the [HttpGet] controller for the view that lists the pages for the selected album. When I do this, the call looks like this:</p> <pre><code>return RedirectToAction("ManagePages", new { albumId = model.AlbumId }); </code></pre> <p>This unfortunately makes the url have the album id shown: <a href="http://XXX/ManagePages?AlbumId=56" rel="nofollow">http://XXX/ManagePages?AlbumId=56</a>.</p> <p>How can I return to the ManagePages view for the same selected album without showing the album id in the parameter list?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload