开发者

ASP.NET binding object to Request in asp.net mvc

I've created a object that I'd like to have accessible from wherever the request-object is accessible, and to "die" with the request, more or less like how you always in a mvc-appli开发者_Python百科cation has access to the RouteData-collection. Especially it's important that I have access to this object in the execution of action-filters. And also there need to be created a new object of my class whenever a new request is made to the page (the object needs to be request-safe, ie. only one request modifies that one object).

Any thoughts about how to achieve this?


HttpContext is a good place for this. The Items dictionary could be used to store objects relative to the request.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜