Response is not available in this context error on a page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maniishkumar
    New Member
    • Mar 2008
    • 1

    Response is not available in this context error on a page

    I am writing a string as
    Response.Write( "Hello world");
    on Page_UnLoad() event.
    I am using ASP.NET with C#.

    When I execute this error and run the application I found this error that Response is not available in this context.

    I tried to write this as HttpContext.Cur rent.Response.W rite("Hello World") but again it gives save error?

    Don't we get the Response object on page unload.
  • saran23
    New Member
    • Mar 2008
    • 28

    #2
    Originally posted by maniishkumar
    I am writing a string as
    Response.Write( "Hello world");
    on Page_UnLoad() event.
    I am using ASP.NET with C#.

    When I execute this error and run the application I found this error that Response is not available in this context.

    I tried to write this as HttpContext.Cur rent.Response.W rite("Hello World") but again it gives save error?

    Don't we get the Response object on page unload.
    try using Javascript, I think its possible with only Javascript, when the page gets unloaded the memory for the objects used is cleared, so u might not get Response.Redire ct work.

    Comment

    • kunal pawar
      Contributor
      • Oct 2007
      • 297

      #3
      on unload event, it dispose all resources to it is not possible to used response object in that context

      Comment

      Working...