Change the url

E

Eric

Hi,

In the load event of my page I have the following code:
If verzoek(1) = "4" And verzoek(2) = "5" Then
Server.Transfer("~\PresentFile.ASPX?file=" + verzoek(4) + ".OV2",
False)
Response.ClearContent()
Response.ContentType = "application/x-unknown" ' arbitrary
Response.AddHeader("Content-Disposition", "attachment; filename=" +
verzoek(4) + ".OV2")

Dim adoStream As Object = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(Server.MapPath(".\temp\" + verzoek(4) +
".OV2"))
Response.BinaryWrite(adoStream.Read())
adoStream.Close()
adoStream = Nothing
Response.RedirectLocation = "~\sitenum.aspx"

Response.Flush()
Threading.Thread.Sleep(2000)
End If

verzoek(1) and verzoek(2) are 2 arguments in the url of the page:

"~\siteinfo.aspx?Do=4&answer=5"

With the above code I get a nice popup so the user can decide what to do
with the file (save/open).

In de menu I have several linkbuttons, each has a
response.redirect("~\somepage.aspx").

Now my problem is that after the popup, I can click on any linkbutton, I
keep getting the popup again.

So I need to change the url, i.e. remove the two arguments so the main page
is loaded, because a respone.redirect after the response.flush is not
possible.

How can I do this?

rg,
Eric
 
E

Eric

fyi: ignore the line with Server.Transfer.... it's a leftover from an other
attempt and should not be there
 
M

miher

Hi,

From the posted code i'm not sure, but i think that wrapping Your code into
an if and checking for Page.IsPostBack would help You.
Something like this :

If Not Page.IsPostBack Then
' Your code here
End If

(hope i did not make any syntax errors, my VB is weak)

Hope You find this useful.
-Zsolt
 
E

Eric

Thanks, but I already solved it.

I have put the code in a seperate form and call it with
response.redirect("...",false)
The false argument did the trick.

rg,
Eric
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top