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

P

Pepehammer

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:
 
S

Scott Allen

Can you give us some more details about how this method is called?
Seeing the call stack might provide some good information.
 
C

Craig Deelsnyder

Not trying to use this in global.asax file are you?

Greg
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.
 
G

Greg Burns

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.

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
 
C

CTifer


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


-
CTife
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top