English 中文(简体)
是否安全地将目标文字储存在伙伴关系中已成不变的固定变量中。 NET?
原标题:Is it safe to store an ObjectContext in a thread static variable in ASP.NET?

I ve读到,我应在<代码>HttpContext.Current上储存一个<代码>ObjectContext/code>,以便在请求中要求的不同服务/储存库之间共享我的<代码>ObjectContext/code>。 I m 想知道使用<条码>的正文/代码>是否安全,代之以<条码>。 这样做是否安全? 每一项请求是否在自己看来得到处理?

最佳回答

无,可在同一个路口提出多重要求,更重要的是,one请求可在多个路面<>处理。 这称为已读/b>,如果你储存在现成变量中,而不是根据情况,你会遇到问题: 伙伴关系。 NET从一对一对二的“,在同一个要求<>期间,HttpContext仍然可以查阅,但现成变量并非。

与进一步信息的一些联系:

问题回答

处理一项请求时使用单一线透镜,在现有请求完成之前,不再使用任何其他要求。 然而,你们需要考虑如何确保即使在出现特殊情况的情况下也处置您所指的物品。 read一结束,就要求重新处理其他请求。 您不希望从先前的请求中透露出来。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!