Re: Posting Button_Click events to Web Page
From: Richard T. Edwards_at_pwpsquared.net (Edwards_at_pwpsquared.net)
Date: 02/19/04
- Next message: Richard T. Edwards_at_pwpsquared.net: "Re: equivalent of web.config?"
- Previous message: Richard T. Edwards_at_pwpsquared.net: "Re: Export Access 97 to txt file"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 19 Feb 2004 13:48:19 -0800
Hello Allen:
As you know, when an event fires in VB, anything that isn't global to the
form will not see anything that was set inside that event after the event
ends.
Same thing happens in the browser. Which is why your unable to perform two
event sequences at the same time.
However, you can do this inside the VB application. Simply trap for the
first event and then tell the browser to go to the next page.
"Allan Cammish" <allancammish@hotmail.com> wrote in message
news:f95ff8c9.0401091530.4f9918f9@posting.google.com...
> Dear all
>
> I have a problem which I think can be solved by using a Visual Basic
> program to simulate the user clicking on a button inside a webpage
> which is already open in I.E 6. This may work by posting the click
> event to the server page, or by automating the click on the button in
> I.E.
> The problem I have is that I am using Response.WriteFile in ASP.NET on
> the server to send a file to the user's browser and when the file has
> finished loading, I want the user's web page to navigate to the next
> page. The user clicks a button on the webpage which uses
> Response.Redirect("sendfile.aspx") to enable the user to download a
> file which just happens to be a VB 6 program. The VB program examines
> the users computer and posts this data to the server. When this has
> been done, I want the user's browser to automatically navigate to the
> next page.
> This sounds simple, and I have tried many different ways, but I can
> not get the browsers page to automatically navigate. This is because
> the user clicking on the button which navigates to the sendfile.aspx
> page uses up an event and there can be no other response.redirect
> event after response.writefile, or so it seems.
>
> The code in sendfile.aspx looks like this:
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles MyBase.Load
> Dim sUniqueID As String
> Dim filepath As String =
> "C:\Inetpub\wwwroot\website\memberarea\CheckSystem.exe"
> sUniqueID = CStr(Session("UNIQUEID")) & ".exe"
> If Not filepath Is Nothing Then
> If File.Exists(filepath) Then
> Dim filename As String =
> Path.GetFileName(filepath)
> Response.Clear()
> Response.ContentType = "application/octet-stream"
> Response.AddHeader("Content-Disposition",
> "attachment; filename=""" & sUniqueID & """")
> Response.Flush()
> Response.WriteFile(filepath) 'does not pause until
> the download has completed. This is the problem (I think)
> Response.End()
> End If
> End If
> End Sub
>
>
> The code for the web page the user clicks the button to initiate the
> download on looks like:
>
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal
> e As System.EventArgs) Handles Button1.Click
> Response.Redirect("sendfile.aspx")
> Response.Redirect("memberarea.aspx") 'This does not work
> and is just here for demonstration of the desired action.
> End Sub
>
> Private Sub Button2_Click(ByVal sender As System.Object, ByVal
> e As System.EventArgs) Handles Button2.Click
> Response.Redirect("memberarea.aspx") 'This is the button
> which I would like to automate to overcome this problem
> End Sub
>
>
> I am hoping that there is a way around this and one way would be to
> make the vb program that is downloaded navigate the users browser to
> the "memberarea.aspx" page as the last thing it does before
> terminating.
>
> Any help much appreciated!
>
> Allan Cammish
- Next message: Richard T. Edwards_at_pwpsquared.net: "Re: equivalent of web.config?"
- Previous message: Richard T. Edwards_at_pwpsquared.net: "Re: Export Access 97 to txt file"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|