Solved

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

Posted on 2006-11-13
6
1,296 Views
Last Modified: 2009-02-06
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.
0
Comment
Question by:MNDOC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 10

Expert Comment

by:jnhorst
ID: 17932123
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
 
LVL 1

Author Comment

by:MNDOC
ID: 17932375
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
 
LVL 1

Author Comment

by:MNDOC
ID: 17932419
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
 
LVL 1

Author Comment

by:MNDOC
ID: 18040384
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
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 18077180
PAQd, 125 points refunded.

DarthMod
CS Moderator
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SSRS Deployment problem 5 125
asp web application 3 55
Display info from DB to Label in asp.net 7 44
history of pages 7 51
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question