Вопрос по asp.net-mvc, c# – MVC C # TempData

16

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded jpmc26

Ваш Ответ

3   ответа
2

public TempDataDictionary TempData { get; set; }

Error: User Rate Limit Exceededplayframework.com/documentation/2.6.x/JavaSessionFlashError: User Rate Limit Exceeded
22

only use it during the current and the subsequent requests only! Since TempData works this way, you need to know for sure what the next request will be, and redirecting to another view is the only time you can guarantee this. Therefore, the only scenario where using TempData will reliably work is when you are redirecting. This is because a redirect kills the current request (and sends HTTP status code 302 Object Moved to the client), then creates a new request on the server to serve the redirected view. Looking back at the previous HomeController code sample means that the TempData object could yield results differently than expected because the next request origin can't be guaranteed. For example, the next request can originate from a completely different machine and browser instance.

Error: User Rate Limit Exceeded

9

ViewBag

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Controller

ViewBag.Name= "Lion";

View

<div>
  <h4>@ViewBag.Name</h4>
 </div>

TempData

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

TempData["Name"] = "Lion";

Error: User Rate Limit ExceededError: User Rate Limit Exceeded

Похожие вопросы