Dave Burke - Freelance .NET Developer specializing in Online Communities

A freelance .NET Developer

Passing Context

Today I redesigned an ASP.NET app that outputs to Excel, placing the codebehind in a separate project namespace.  All was well as a UserControl with codebehind in the same directory, but I got hit with Object reference not set to an instance of an object for the Response object. 

This Alvin Bruney newsgroup response gave me the clue I needed to pass HttpContext.Current to the class.  Actually, I didn't have to “pass” anything, just prefixed my Response.Writes with HttpContext.Current, which did the trick.

Comments

Jack Colorado said:

Phew! I'm glad I ran into this blog... that little bit of info you give here solved a really big problem I was having... I wanted to make a generic ErrorHandler class that would do some specific things that I wanted it to, but it needed the Session and Response objects... this juicy bit o' info was exactly what I needed. Woot! =)
# June 9, 2004 12:50 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)