Passing TempData with RedirectToAction

前端 未结 5 1587
夕颜
夕颜 2021-02-13 15:27

Intro: I am a .NET studet trying to learn ASP.NET Core MVC. So please be understanding. I have searched the web for an answer to my problem, but havent found a solution that wor

5条回答
  •  没有蜡笔的小新
    2021-02-13 16:01

    I'm just posting this for anyone who comes across this problem in an ASP.NET MVC application, @Ahmar's answer made me go look at my logout method, I was using Session.Abandon() before redirecting to the login page.

    I just changed it to Session.Clear() to reset the session instead of removing it completely and now the TempData is working in the method I'm redirecting to.

提交回复
热议问题