MVC - Passing Data with RedirectToAction()

前端 未结 8 2085
既然无缘
既然无缘 2020-12-01 15:17

I\'d like to take data entered in an MVC user form and display it in a different view.

The class has the following private variable:

IList

        
相关标签:
8条回答
  • 2020-12-01 16:17

    The problem with RedirectToAction is it's returning a HTTP 302 and the browser is then on it's own going and doing a brand new HTTP request. You may want to consider using a cookie and/or session object to persist the data between requests.

    0 讨论(0)
  • 2020-12-01 16:18

    Try using TempData. It is like a single-shot session object. You put values you want into TempData, immediately redirect and get them out. There is a good writeup here: http://blogs.teamb.com/craigstuntz/2009/01/23/37947/

    0 讨论(0)
提交回复
热议问题