A little background. A developer I used to work with insisted on disabling Tempdata and using Session Flash for passing data in the return view.

Question is, is there any advantage to doing it this way? using a flash message is great for returning data to the user but I've had headaches with passing data from one post to the next with tempdata disabled.

Is there any problem with using flash and tempdata together or is this a major coding faux paus?

1 Answer 1


Temporarily putting things in the session is going to lead to strange behavior when a user opens up 2 or more windows. TempData is best for persisting data briefly.

Also, sessions can be cleared a variety of ways. TempData will rewrite a bit of data on the page to be posted back and will last as long as the window isn't closed.

There's also the problem of session scalability. Most applications won't run into a problem here but larger applications can be affected.

If you're still not convinced here's a coding guidelines document from Microsoft encouraging the use of tempdata over the session

  • Thanks. I was never convinced that his use of session flash was the correct way to go and your answer and the link confirm this.
    – Brian
    Apr 16, 2012 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.