Lost HttpContext in a custom event
<p>I'm getting the 'Response is not available in this context error' calling the following function:</p>

<pre><code>Private Sub ReloadPage(ByVal inNumber As Integer) Handles tempaux.Advertise
    'Response.Redirect("tope.aspx?dep=" &amp; CStr(inNumber))
    Response.Write("&lt;script&gt;window.open('tope.aspx?dep= &amp; CStr(inNumber)','topFrame');&lt;/script&gt;")
End Sub
</code></pre>

<p>I've changed the line adding the System.Web.HttpContext.Current before Response.Write and I get 'Object reference not set to an instance of an object'.</p>

<p>To give some background: tope.aspx is, as you can see, opened in topframe. As soon as it loads it starts a CustomTimer object I've defined:</p>

<pre><code>Public Class tope
    Inherits System.Web.UI.Page
    Public funciones As funciones = New funciones
    Dim WithEvents tempaux As CustomTimer = Global.objCustomTimer

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim inUserProfile As Int64
        Try
            tempaux.StartTimer()
        Catch ex As Exception
            'bla bla
        End Try
</code></pre>

<p>As you can see I've declared the CustomTimer in the Global.asax. The CustomTimer object raises an Advertise event every 5 seconds and passes 'inNumber' as a parameter for the tope.aspx page to refresh some label, a simple thing. CustomTimer is a class I made to manage the timer, it doesn't inherits any other class( For what I've learned in my search it has to inherit some httpthing but I'm not sure). I'm guessing that at some point the httpcontext is being lost (I've searched in google and I couldn't figure its lifecycle or whatever information that tells me why it 'dies). Can anyone help me to find out what is the problem?</p>

<p>thanks</p>
