Yearly Archives: 2008

Cold Fusion Request Variable Type for ASP.NET

i know i’m late to the party most times but i want to share this with any ASP.Net web developers that will find this as useful as myself… and i find it very useful. i dev’d some Cold Fusion code back in the day… it was a job what can i say… anyhow i remember the coolest variable type ever that CF had.. it was the ‘request’ variable. not to be confused with the ASP and ASP.Net request object. in ColdFusion a request variable is just a generic variable that can be read and written too throughout the entire HTTP request thread… all without needed to be passed around like local variables and without the excessive memory overhead of session variables.

for the last several years while working in a .Net world i’ve had to settle on either explicit passing of local variables (yuck… pain to build for and maintain) or session variables (ugh… easy but you know you’re utilizing a lot more memory than you really need). but today the simplest thing dawned on me… the Page object is scoped very similarly to an HTTP request… and it has an Items collection… and you can read and write entire objects into the Items collection. best of all at the end of the Page’s lifecycle the Items collection is disposed of and the memory is free… free at last!

so there you go, if you’ve ever needed a Cold Fusion style request variable in ASP.Net use Page.Items.

it’s super easy, but here’s an example of setting and reading:

[VB]
‘ this creates the ‘item/variable’
Page.Items.Add(“Name”,”Value”)

‘ this is where you read it
‘ remember you can read from anywhere during
‘ the request (like from a user control)
Response.Write(Page.Items.Item(“Name”))

[C#]
// this creates the ‘item/variable’
Page.Items.Add(“Name”,”Value”)

// this is where you read it
// remember you can read from anywhere during
// the request (like from a user control)
Response.Write(Page.Items.Item[“Name”])

Comedy Movie March Madness

yeah so it’s barely January and I’m already bringing up March… sorry… but i stumbled upon this cool little comedy movie March Madness bracket… while researching various College Basketball March Madness brackets… and wanted to share. from the movies listed my finals came down to “The Jerk” with Steve Martin and “Old School” with Wil Ferrell, Vince Vaughn & Luke Wilson. who won? i can’t pick it… i could watch either movie at almost any given point in time… if it’s on i’m probably not going to turn it off.

see what comedies you take to the final four >> Comedy Movie March Madness Bracket