Multithreading and ASP.net

From: Shathish (nshathish_at_gmail.com)
Date: 10/18/04


Date: 18 Oct 2004 09:23:41 -0700

Hai
i am trying to write a multithreading asp.net application
this is the code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        If Not IsPostBack Then
            Try
                DisplayLoadingMovie()
                StartThread()
            Catch ex As Exception

            End Try
        End If
    End Sub

    Private Sub GetPlaceHolders()
        Try
            Thread.Sleep(7000)
            Dim strScript As String
            strScript = "<script language=javascript>"
            strScript &=
"window.parent.fra2.location.href='AfterLoading.aspx?Finished=Y';"
            strScript &= "</script>"
            Response.Write(strScript)
        Catch ex As Exception

        End Try
        
    End Sub

    Private Sub DisplayLoadingMovie()
        Dim strScript As String
        strScript = "<script language=javascript>"
        strScript &=
"window.parent.fra2.location.href='Loading.aspx';"
        strScript &= "</script>"
        Response.Write(strScript)
    End Sub

    Private Sub StartThread()
        Dim dlgThreadStart As ThreadStart = New ThreadStart(AddressOf
GetPlaceHolders)
        Dim workerThread As Thread = New Thread(dlgThreadStart)
        workerThread.Start()
    End Sub

but wheni try to run the program the GetPlaceHolders method generates
a HttpException saying "Response is not available in this context"
Anyone got any idea how to work around the problem



Relevant Pages

  • Re: Events - weiterreichen
    ... Private Sub Button5_Click(ByVal sender As System.Object, ... ByVal e As System.EventArgs) Handles Button5.Click ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: Displaying calendar month according to Datalist choice
    ... Private Sub Page_Load(ByVal sender As System.Object, ... Dim dtNewDate As DateTime ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Was bedeutet Paralellitätsverletzung?
    ... Private Sub goFrmSpracheVerwalten_Load(ByVal sender As ... ByVal e As System.EventArgs) Handles MyBase.Load ... Private Sub cmdSchliessen_Click(ByVal sender As System.Object, ...
    (microsoft.public.de.german.entwickler.dotnet.datenbank)
  • MULTITHREADING: Transform simple sample program using threads
    ... order to understand multithreading. ... to transform this program into a multithread program. ... Private Sub Form1_Load(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: intermec multiple barcode read events
    ... private void TransporterForm_Deactivate(object sender, EventArgs e) ... > Form2 has it's own instance of a barcode reader object. ... > Public Sub New ... > Private Sub Form1_Load(ByVal sender As Object, ...
    (microsoft.public.dotnet.framework.compactframework)

Loading