By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,710 Members | 1,613 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,710 IT Pros & Developers. It's quick & easy.

Why i get this error: Response is not available in this context

P: n/a
Exception Details: System.Web.HttpException: Response is not available in
this context.

Source Error:

Line 16: '---------- // SUB : WriteString
Line 17: Public Sub WriteString(SayItNow as String)
Line 18: Response.Write(SayItNow)
Line 19: End Sub
Line 20:
Nov 18 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Can you give us some more details about how this method is called?
Seeing the call stack might provide some good information.

--
Scott
http://www.OdeToCode.com

On Wed, 21 Jul 2004 18:52:12 -0400, "Pepehammer"
<pe********@hotmail.com> wrote:
Exception Details: System.Web.HttpException: Response is not available in
this context.

Source Error:

Line 16: '---------- // SUB : WriteString
Line 17: Public Sub WriteString(SayItNow as String)
Line 18: Response.Write(SayItNow)
Line 19: End Sub
Line 20:


Nov 18 '05 #2

P: n/a
Not trying to use this in global.asax file are you?

Greg

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:vu********************************@4ax.com...
Can you give us some more details about how this method is called?
Seeing the call stack might provide some good information.

--
Scott
http://www.OdeToCode.com

On Wed, 21 Jul 2004 18:52:12 -0400, "Pepehammer"
<pe********@hotmail.com> wrote:
Exception Details: System.Web.HttpException: Response is not available in
this context.

Source Error:

Line 16: '---------- // SUB : WriteString
Line 17: Public Sub WriteString(SayItNow as String)
Line 18: Response.Write(SayItNow)
Line 19: End Sub
Line 20:

Nov 18 '05 #3

P: n/a
On 7/21/2004 10:00 PM, Greg Burns wrote:
Not trying to use this in global.asax file are you?

Greg

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:vu********************************@4ax.com...
Can you give us some more details about how this method is called?
Seeing the call stack might provide some good information.

--
Scott
http://www.OdeToCode.com

On Wed, 21 Jul 2004 18:52:12 -0400, "Pepehammer"
<pe********@hotmail.com> wrote:

Exception Details: System.Web.HttpException: Response is not available in
this context.

Source Error:

Line 16: '---------- // SUB : WriteString
Line 17: Public Sub WriteString(SayItNow as String)
Line 18: Response.Write(SayItNow)
Line 19: End Sub
Line 20:


Can almost guarantee it's being used outside of Page, etc. You have to
use System.Web.HttpContext.Current.Request to access request in
'non-web' classes.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #4

P: n/a
> Can almost guarantee it's being used outside of Page, etc. You have to
use System.Web.HttpContext.Current.Request to access request in
'non-web' classes.


Yes, very true. You can use that inside any class not inhereting from Page.
Exception Details: System.Web.HttpException: Response is not available inthis context.


But, this specific error I've seen when trying to Response.Redirect from
events like Session_End until you learn you just can't to do that. :)

Greg
Nov 18 '05 #5

P: n/a
B>


Thanks, Craig. I was having this issue and your answered helped me in
my scenario. I even registered for these forums just to give this
thread my seal of approval.

--
CTifer
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

May 4 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.