The Adventures of a SQL Server DBA
Tips on T-SQL, SQL Server DBA stuff, and more!
Friday, March 25, 2011
Getting Access to the Response Object from a Regular C# Class (and NOT a code-behind)
When I attempt to call Response.Write() or Response.Redirect() from a genuine C# class (NOT a code-behind), I get an interesting error:
"Response is not available in this context."
However, call it this way and it should work fine:
HttpContext.Current.Response.Write("Hello, World!");
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment