Problems doing a response.BinaryWrite(ImageData) from a Modal Page

I have created a page that displays documents from a SQL db table and is opened in a Modal Page. I am trying to do a response.BinaryWrite(ImageData) to view the document.

I have done this in 1.1 and it worked correctly. But now in 2.0 and in a modal window it seems to just hang. I have added <base target="_self"/> to the design side. I have not found a solution to this problem. Does anyone know of any solutions to this? Thanks, all.
LVL 1
MNDOCAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
DarthModConnect With a Mentor Commented:
PAQd, 125 points refunded.

DarthMod
CS Moderator
0
 
jnhorstCommented:
What kind of document is it?  You may need to set the Response.ContentType = "..." such that the ContentType matches the kind of document you are writing.

John
0
 
MNDOCAuthor Commented:
From what I can tell, it seems to be a problem with <base target="_self"/>. If I remove this, the binaryWrite will work. But then the modal page links don't wire up correctly. So I need the <base target="_self"/>. Any suggestions? Thanks, again.
0
 
MNDOCAuthor Commented:
John,
My code looks like this
I get FileName, ContentType, ImageData from a call to the db. Then return it to the page and use it in the following.

Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition", "attachment; filename=" + FileName)
Response.ContentType = ContentType
Response.BinaryWrite(ImageData)
0
 
MNDOCAuthor Commented:
Figured out what I needed to do.
To work, I needed to open the displayfile page in a new window. So basically I needed to add .target = "_top" which would open up the page with the following code in a new window.

Also, I needed the following, it would not work without the clearheaders().

Response.BufferOutput = True
Response.ClearHeaders()
Response.AddHeader("content-disposition", "attachment; filename=" + FileName)
Response.ContentType = ContentType
Response.BinaryWrite(ImageData)

I have not found a better solution than having to open the code in a new window.
0
All Courses

From novice to tech pro — start learning today.