TempData:安全吗? [英] TempData: Is It Safe?

查看:153
本文介绍了TempData:安全吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用TempData以便在使用RedirectToAction时保留我的模型.它工作正常,但是我有点a恼,认为这可能不是正确的选择.我确实尝试避免使用Session数据,并且我已经读到TempData使用Session.使用安全吗?在负载平衡的环境中使用它可能会出现问题吗?

I am using the TempData in order to preserve my model in when using a RedirectToAction. It works fine, but I have a nagging feeling that it might not be the right thing to do. I really try to avoid using Session data, and I've read that TempData uses the Session. Is it safe to use? Are there issues which might arise in using it in a load balanced environment?

琐事问题:安全吗?"-为电影命名.

Trivia Question: "Is It Safe?"-- name the movie.

推荐答案

是的,TempData由会话存储支持,因此,如果您处于负载平衡的环境中,则在使用它时必须格外小心(粘性会话,持久会话状态)等).

Yes, TempData is backed by session storage, so if you are in a load balanced environment extra care must be taken when using it (sticky sessions, persistent session state, etc).

在使用PRG模式时,TempData一直是事实上的选择,这是它的设计目的.

TempData has been the de-facto choice when using the PRG pattern, and is what it was designed for.

关于这样做是否正确……取决于您的用例!

As to whether it's the right thing to do... it depends on your use case!

PS马拉松男子.

这篇关于TempData:安全吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆