Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

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

share|improve this answer
    
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 '12 at 19:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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