Response is not available in this context - page blowing

Discussion in 'ASP .Net' started by rao, Aug 27, 2004.

  1. rao

    rao Guest

    Hi

    I am generating unique xml files and deleting them in page_unload event.
    Application responds properly in normal conditions. When I keep clicking
    on url that invoke the page several times the application blow up with
    following error "Response is not available in this context". This happens
    only when I keep clicking on link for stress test. Here is the code I process
    on page_unload event. Any suggestions are welcome.


    Thanks
    Rao


    private void Page_UnLoad(object sender, System.EventArgs e)
    {
    try
    {
    if (File.Exists(Server.MapPath(xmlDocPath+ProjectsDoc)))
    {
    File.Delete(Server.MapPath(xmlDocPath+ProjectsDoc));
    }
    if (File.Exists(Server.MapPath(xmlDocPath+ResourcesDoc)))
    {
    File.Delete(Server.MapPath(xmlDocPath+ResourcesDoc));
    }
    }
    catch(Exception ex)
    {Response.Write(ex.Message.ToString());}
    }
     
    rao, Aug 27, 2004
    #1
    1. Advertising

  2. rao

    Karl Guest

    The error message is pretty clear, Response isn't available in the context.
    In other words, you can use Response.Write in the Page_Unload event. The
    only relation that this has to your fast clicking is that it's causing an
    exception to be thrown.

    Karl


    "rao" <> wrote in message
    news:...
    > Hi
    >
    > I am generating unique xml files and deleting them in page_unload event.
    > Application responds properly in normal conditions. When I keep clicking
    > on url that invoke the page several times the application blow up with
    > following error "Response is not available in this context". This happens
    > only when I keep clicking on link for stress test. Here is the code I

    process
    > on page_unload event. Any suggestions are welcome.
    >
    >
    > Thanks
    > Rao
    >
    >
    > private void Page_UnLoad(object sender, System.EventArgs e)
    > {
    > try
    > {
    > if (File.Exists(Server.MapPath(xmlDocPath+ProjectsDoc)))
    > {
    > File.Delete(Server.MapPath(xmlDocPath+ProjectsDoc));
    > }
    > if (File.Exists(Server.MapPath(xmlDocPath+ResourcesDoc)))
    > {
    > File.Delete(Server.MapPath(xmlDocPath+ResourcesDoc));
    > }
    > }
    > catch(Exception ex)
    > {Response.Write(ex.Message.ToString());}
    > }
     
    Karl, Aug 27, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MS News \(MS LVP\)

    Re: Response is not available in this context

    MS News \(MS LVP\), Aug 7, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    2,096
    MS News \(MS LVP\)
    Aug 7, 2003
  2. Natty Gur
    Replies:
    0
    Views:
    2,598
    Natty Gur
    Jun 6, 2004
  3. Pepehammer
    Replies:
    5
    Views:
    14,126
    CTifer
    May 4, 2006
  4. Replies:
    0
    Views:
    10,217
  5. Flip Rayner
    Replies:
    1
    Views:
    705
    bruce barker
    Jan 23, 2007
Loading...

Share This Page