Use Session in MVC or not?

I'm reviewing this junior developer's code and he's used Session. I think there's a better way of doing this and not use Session. I also read somewhere, a while back, not to use Session.

He doesn't clear the session.

  if (search.Schedule.Invoices.Any())
                Session["leaseSched"] = search.Schedule.LeaseNoSchedule;

and then in a link

<div class="btn-group pull-right">
    <h5>@Display <a href="@Url.Action("Detail", "Schedule", new { @id = Model.ScheduleID })">@Session["leaseSched"].ToString()</a></h5>

Any arguments against using Session in MVC?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle AbrahamsSenior .Net DeveloperCommented:
It depends on what you're using it for.

If it's only for redirects, you can get away with TempData.

A good place for learning the differences between TempData and session:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CamilliaAuthor Commented:
Thanks, Kyle. I think TempData is better.
kaufmed   ( ͡° ͜ʖ ͡°)*whispers*  I C# people.Commented:
If it's only for redirects, you can get away with TempData.
TempData actually uses session under the hood.
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

CamilliaAuthor Commented:
Ha, didnt know. The link Kyle posted lists the differences.
CamilliaAuthor Commented:
I've been reading about use of session in mvc . Looks like session is not the best practice.
Kyle AbrahamsSenior .Net DeveloperCommented:
TempData actually uses session under the hood.

Yes, but only for the redirect.  Normal session keeps it live even after the page is loaded.
kaufmed   ( ͡° ͜ʖ ͡°)*whispers*  I C# people.Commented:
Agreed, but I mention it because that means if you use TempData, then you can't disable session for your app.
CamilliaAuthor Commented:
Thanks, Kauf. Makes sense. I thought you meant there's no difference between using session or tempdata.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.