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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:14:35+00:00 2026-06-15T20:14:35+00:00

I asked a previous question here and one part of it seems to be

  • 0

I asked a previous question here and one part of it seems to be a whole subject in itself.

I am attempting to preserve a files data across controller calls.

The scenario is: A user uploads a file containing entries to be submitted to a database. If the file has warnings and errors they’ll be redirected to a validation page. If there are no warnings or errors their file will be directly processed.

If the user receives warnings but no errors (ie. a text field is too long and will be truncated) they can still import the file. As there are two separate screens between uploading the file and sending it to the database the file data will need to be preserved.

I have seen a dozen similar questions to this but none of them seem to have relate-able answers (so please don’t mark this question as a duplicate if a similar question doesn’t have an answer to this exact problem).

My first idea was to save the file using the uploaded file name + a guid and saving that file name to the session state, but the answers I got on my previous question were all pretty adamant that this was a terrible solution.

The solutions I have found to other similar questions:

  1. Reupload the file (a terrible solution)
  2. Using a viewbag to send the file name to the view, to be sent back to the second controller (doesn’t sound right)
  3. Save the file location in the view model to be sent to the view, to be retrieved again by the second controller (again doesn’t sound right)
  4. Save the file location in the session or in temp data (receive generally unfavorable remarks)

I have done my research and cannot find the best way to go about this. Can someone please help me? If you think another question answers this, can you please send it to me as an answer instead of reporting this as a duplicate as I have already done quite a bit of searching.

Thank you,
Samuel Davis

EDIT: my users do have a session available. Another solution I could think of is appending a hardcoded string to the GUID contained within their session ID eg. “MyImporter-xxxx.xxxx.xxxx.xxxx.csv”. This way “MyImporter” could be a private constant string, and my controller wouldn’t have to persist any identifier. I am unsure of any downsides to this method, but as I am pretty fresh to MVC there should certainly be cases that I haven’t thought of.

  • 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-15T20:14:37+00:00Added an answer on June 15, 2026 at 8:14 pm

    The best would be to store the location of the file on your server. Session or database.

    Flow:

    1. User uploads a file
    2. The server stores the file in a some location on the server and stores the location of this file in a Session variable or in the Database
    3. The user sends a second request
    4. The server retrieves the location from the Session or the Database.
    5. The server does something with the file

    It’s worth mentioning that if you decide to store the file location in a database, you should also store the currently authenticated user in the same table so that you could later retrieve the correct record. If you are not using authentication that might not be a good solution because you will not be able to retrieve the record. In this case you could use a hard to guess identifier in the database to store the file location under. Then this identifier will be passed to the view (under the form of a view model of course) and passed on subsequent request. It is important that this identifier is difficult to guess to avoid one user working with the files of another user.

    Another possible solution might be to store the location of the file in an encrypted cookie which will be sent on subsequent request.

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

Sidebar

Related Questions

This is a related to a previous question I have asked here, see the
Sorry for the redundancy, I should've asked this in my previous question here: What's
Continuing a previous question I asked here , I now need to move to
I know this question has already asked here, but I can't figure this one
This is a separate problem lingering from a previous question I asked here on
This question is to piggy back off of a previous one I asked yesterday
This is in relation to a previous question I asked here. Calling replaceAll(\n, <br
based my previous question asked here: Jquery Filter List DIVs via checkboxes i got
In a previous question I asked, the suggested answer was for me to partition
In a previous question I asked about how to group XML elements logically, and

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.