views:

525

answers:

3

The title says it all really, but to clarify what HttpContext.Current.Items is, it's a store that has a life span of the HTTP request.

I'd like to know the Classic ASP equivalent of this.

+4  A: 

There is no equivalent of that in Classic ASP. You only have objects like Request, Response, Session, Application, Server for that purpose.

çağdaş
+1 However a small correction, there _is_ no equivalent. Note current tense, despite a poor prognosis ASP classic will remain with us for a little while yet. ;)
AnthonyWJones
@AnthonyWJones, :) editing the answer to use present tense.
çağdaş
+1  A: 

You could use Session to store stuff from page to page in a similar manner:

Session("MyVar") = "my value to keep"

But in ASP theres not much skipping around pages as you would in .net with user controls etc. You might be better off with some globals?

If you give us a bit more context (no pun intended) might be able to point you in the right direction better.

Pete Duncanson
Context.Items does not survive "page to page", although I agree that the closest you can get is to use the Session object to store primative items and then drop them from the Session before completing the request, its still quite feeble compared with Context.ITems.
AnthonyWJones
Thats the whole problem though, there is no like for like match for Context.Items in ASP so you'll never find anything that totally matches. Its difficult trying to retro fix newer tech to older tech. Its doable but with some trade offs normally. Session is the way to achieve this in ASP, thats what it was build for, users from the .net world though need to adjust how they use it though so as not to abuse it because as you right say its not cleared after each request as Context.Items is
Pete Duncanson
A: 

A collection object with global scope would accomplish the same thing.

David
Not quite. Typically you would use the Context.Items to collect values to be shared with other components that may be invoked during the processing of a request. The closest that ASP gets to that sort of thing is Server.Execute or Server.Transfer neither of which could achieve an equivalent by using a global scope collection.
AnthonyWJones