Derin
Derin

Reputation: 135

Where does a HttpContext value get stored

I would like to know, if I store a value using HttpContext.Current.Items.Add, where does it get stored? Is it on the Server, or client side like ViewState?

Will storing values in HttpContext.Current.Items.Add give problems in a Web farm situation?

Thanks in advance.

Upvotes: 2

Views: 2215

Answers (4)

Widor
Widor

Reputation: 13275

HttpContext.Current.Items is basically an IDictionary object (hashtable) whose scope is the life of the request.

See https://web.archive.org/web/20201202215202/https://www.4guysfromrolla.com/articles/060904-1.aspx

Upvotes: 0

Burt
Burt

Reputation: 7758

I think the HTTPContext is stored on the server it comes from the HTTP request.

Upvotes: 0

Aliostad
Aliostad

Reputation: 81660

It is stored in the thread storage area.

I am not going into much detail for asynchronous processing when thread changes but in a context switch, context gets copied - I believe.

Upvotes: 4

Darin Dimitrov
Darin Dimitrov

Reputation: 1038800

It is stored in the memory of the server and the value is available for the entire lifetime of the request.

Upvotes: 3

Related Questions