2

HttpContext.Current.Items is a store that has a life span of the HTTP request.

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

joshcomley
  • 28,099
  • 24
  • 107
  • 147

3 Answers3

5

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

Çağdaş Tekin
  • 16,592
  • 4
  • 49
  • 58
  • +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 May 23 '09 at 21:35
1

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
  • 3,208
  • 2
  • 25
  • 35
  • 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 May 23 '09 at 21:38
  • 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 May 26 '09 at 09:51
0

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

David
  • 34,223
  • 3
  • 62
  • 80
  • 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 May 23 '09 at 21:33