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

  • Home
  • SEARCH
  • 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 4100934
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:37:52+00:00 2026-05-20T20:37:52+00:00

Hi, I have a action that looks like this : [AcceptVerbs(HttpVerbs.Post)] public ActionResult Register(AdRegister

  • 0

Hi,

I have a action that looks like this :

[AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Register(AdRegister adRegister, IEnumerable<HttpPostedFileBase> files)

The AdRegister is a complex class and I need to pass this in to a redirect method further down in the Register action, like this :

return this.RedirectToAction("Validate", adRegister);

The Validate action looks like this :

public ActionResult Validate(AdRegister adRegister)

I do know that I can pass simple parameters but in this case it´s a complex object. This example do not work, the adRegister´s properties will be null.

Is this posible and if so, how?

BestRegards

More Information : Register action will take the adRegister and do som magic on it, then It will be sent to the Validate action. The Validate action will return a validation page to the user. When the user hit the grant button the adRgister will be filled from the form and then sent to the vValidate post where it will be saved. I have looked in to place the adRegister in cache or database temporarily but it will be better if I could simple pass it to the next action.

  • 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-20T20:37:53+00:00Added an answer on May 20, 2026 at 8:37 pm

    One possibility would be to pass the simple properties in the query string:

    return RedirectToAction(
        "Validate", 
        new { 
            foo = adRegister.Foo, 
            bar = adRegister.Bar, 
            ... and so on for all the properties you want to send
        }
    );
    

    Another possibility is to store it in TempData (for the lifetime of the redirect) or Session (for the lifetime of the ASP.NET session):

    TempData["adRegister"] = adRegister;
    return RedirectToAction("Validate");
    

    and then retrieve it from TempData:

    public ActionResult Validate()
    {
        adRegister = TempData["adRegister"] as AdRegister;
        ...
    }
    

    Yet another possibility (and the one I would recommend you) is to persist this object in the POST method in your datastore:

    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult Register(AdRegister adRegister, IEnumerable<HttpPostedFileBase> files)
    {
        ...
        string id = Repository.Save(adRegister);
        return RedirectToAction("Validate", new { id = adRegister.Id });
    }
    

    and then fetch it from the data store after you redirect:

    public ActionResult Validate(string id)
    {
        AdRegister adRegister = Repository.Get(id);
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an action that looks like this: [Post] [PopulateModelFromId] public ActionResult ChangeName( string
I have an action method that looks like this: public ActionResult DoSomething(string par, IEnumerable<string>
I have an action method that looks like this: public ActionResult Index(string message) {
I'm perplexed by this. I have a login action that looks like this: public
I have a controller method that looks like this: [AcceptGet] public ActionResult Index(SecurityMatrixIndexViewModel model)
I have a controller method in ASP.NET MVC that looks like this: public ActionResult
i have ajax function that looks like this: jQuery.ajax({ type: 'POST', data: { action:
I have a controller that looks like this: public ActionResult Sold() { using (WipDBEntities
I have an ajax call that looks like this: $.ajax({ url: '@Url.Action(SaveStudy)', type: POST,
I have a simple class that looks like this: [DataContract] public class Actor {

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.