Why does downloading a file break the webpage?

J

Jeff Cooper

There must be something I'm missing. No else else seems to have this
issue -- at least I don't see it mentioned anywhere.

(Also, my appologies for my earlier posts in which I mistakenly referred to
a <Select> tag as a webcontrol dropdownlist. Here's what's happening:

I have a page inside a frame. On it are a couple of links and a <Select>
tag. The selection list has nothing to do with the links and it works
fine -- usually.

I want one of the links to allow the user to download a short dynamically
created tab-delimited list (*.tab) to his computer. So, I have the follwing
html on the page:

<A href="download.aspx">Download List</A>

Now, here's the code form download.aspx:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'just testing for now, will put real data here later
Dim S As String = "value1" & vbTab & "value2" & vbCrLf & "value3" & vbTab &
"value4"
Response.Clear()
Response.ContentType = "text/tab-separated-values"
Response.AppendHeader("Content-Disposition", "attachment;filename=" &
"myfile.tab")
Response.Write(S)
Response.End()
End Sub

It seems to work fine. The file downloads and looks ok. BUT, after I
download a file, the Selection Box no longer functions unless I reload the
page. It gives me an "Access is denied" error whenever I select a new
value. One note: I have an onchange attribute set for it, which calls a
javascript function that opens a child window.

PLEASE, I'm desperate. Any ideas what's happening? Why does downloading a
file break my web page?

Thanks,

Jeff
 
J

Jeff Cooper

Thank you!

I grabbed all the relevent code and stuck it into a new project and ... the
problem didn't occur. The only difference was the test project I was
preparing to send you did not use frames. So, I stuck it into a frameset
and, voila! got the error. So I pondered for a few moments, tried setting
the target of the link to _top and that seemed to take care of it! Somehow,
linking to a file (or stream or whatever) from inside a frame caused
controls on the page to get "Access is Denied" errors. Setting the target
to _top though, seems to eliminate the problem.

If you're still interested, I'll send off the test project anyway. Let me
know.

Thanks!

Jeff
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top