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 9019625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:49:29+00:00 2026-06-16T04:49:29+00:00

I have two actions in a controller. One that displays a form for file

  • 0

I have two actions in a controller. One that displays a form for file upload and another one that displays the results of the upload.
I have created a POCO called FileInfo i.e

public class FileInfo
    {
        public string Name { get; set; }
        public int Length { get; set; }
        public string FileType { get; set; }
        public string ErrorMessage { get; set; }

    }

When I submit the form, the Upload action creates and populates the FileInfo object and then redirects to the second action called results. I want to be able to use the same file info object in the results action.

I am able to get around this using TemPData[], but it is limited since it only holds object data for a single request. I presume there must be a better way to share abjects between controller actions.Any help is appreciated!

// Upload Action

 List<FileInfo> fileInfo= new List<FileInfo>();
//populate  the fileInfo object using fi.Add()

if ((status.ToString() == "OK"))
             {
                 TempData["Info"] = fileInfo;
                 return RedirectToAction("Results");

             }
             else
             {
                 return RedirectToAction("Index");
             }

//Results action.

public ActionResult Results()
        {
            List<FileInfo> fi = TempData["Info"] as List<FileInfo>;
            if (fi != null)
            {
                return View(fi);
            }
            else
            {
                return View("Index");
            }
        }
  • 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-06-16T04:49:30+00:00Added an answer on June 16, 2026 at 4:49 am

    If you need something to stick around longer then one subsequent request, you will have to put it in Session or in persistent storage (e.g. database).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my controller I have two actions called Friends. The one that executes depends
I have two actions in my controller which are sharing part of logic responsible
I have two actions in my controller : def find @item = Item.find(params[:id]) render
Hi, For a view that will be submited I have two actions with the
MVC newbie question re binders. Supposing I have two strongly typed partial actions that
I have two controller actions outlined below: public ViewResult TitleStorylines(int id) { var vm
I have two very similar specs for two very similar controller actions: VoteUp(int id)
I have a form in which I need to call two action methods, one
I have a User model that, in my mind, has two show actions: A
okay i have a tabbed view, so two view controllers. in one view controller

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.