Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6911081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:54:22+00:00 2026-05-27T08:54:22+00:00

Let me try to set the scenario here first. This is done using ASP.NET

  • 0

Let me try to set the scenario here first. This is done using ASP.NET 4.0, MVC3, and C#.

I have a picture gallery. I have a manager for the albums in the picture gallery. Each gallery has a set of pages.

When I am using the manager for the albums, the view shows a list of current albums.

In the list of albums, there are choices to edit, delete, or manage pages in that album.

When selecting to manage the pages for the album, there is a list of pages, each with edit, delete, and view.

When the edit button for the page is selected, and edits are made then saved, my problem is encountered.

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.

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).

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:

return RedirectToAction("ManagePages", new { albumId = model.AlbumId });

This unfortunately makes the url have the album id shown: http://XXX/ManagePages?AlbumId=56.

How can I return to the ManagePages view for the same selected album without showing the album id in the parameter list?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:54:23+00:00Added an answer on May 27, 2026 at 8:54 am

    You could store the album id in the TempData just before performing the redirect using:

    TempData["AlbumId"] = model.AlbumId;
    return RedirectToAction("ManagePages");
    

    Then in the ManagePages GET action you could read the contents of the id:

    int albumId = (int)TempData["AlbumId"];
    

    Note: Once the id has been read the contents of TempData[“AlbumId”] will be cleared.


    Update:

    Actually, if you use TempData and the user clicks refresh then the data will be lost on the refresh. Therefore, you could instead use the Session:

    Session["AlbumId"] = model.AlbumId;
    ...
    int albumId = (int)Session["AlbumId"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me try it: If I don't set this, then the default value is
Let me try to explain this the best I can. I have a component
Let me try to explain what I need. I have a server that is
There's a lot of conflicting information about this topic. So let's try to agree
Ok, let me try to clearly explain what I'm attempting to accomplish here. Basically,
I'm having some headaches using Structures and functions that return Nothing in VB.NET. Let
First off, I don't know if this is possible, but let me describe my
this will be the first question I've posted here so pardon any unintended lapses
I would like to have an advice for this issue: I am using Jbos
Ok, let me try and explain this to the best of my ability. Lets

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.