ASP, DOC, RTF, ADODB.Stream, ContentType, BinaryWrite, And ReplaceB()
It involves using ASP/VbScript and ADODB.Stream to read binary data from a *.DOC or *.RTF
file and then send it to the user with Response.ContentType and BinaryWrite.
Everything works fine until I try to Replace() certain strings in the *.RTF
file with my own data. I'm assuming Replace() is choking on the binary characters, or
incorrectly thinking 0x00 values are marking end of string. Code:
I`m writing a little routine that captures the data from a form submit (ie a picture) and then at the back end the asp will saved it back out into a file on the server.
I can capture the file fine and display the binary data to the screen.. but now I`m trying to write the data back into a file on the server. After a bit of searching around on the net I found that most people where suggesting using the ADODB.Stream functions.
So this is what I've got but for some reason when I go to write the binary variable it complains. Code:
We have an application, written in ASP, that uses the ADODB.Stream to be able to open files and write byte arrays to the Response object. If one of our administrators patches the web servers this application runs on in Windows Update, I'm screwed, right? You've essentially just disabled this COM object, for not only its evil purposes, but its useful ones?
I am using ADODB.Stream for downloading the files on user machine. The code works fine when filesize is less than 10 MB. But if file size is more than 10 MB then it doesn;t get download. Can anyone tell what is the problem. I have to user some different component.
I am trying to secure .pdf files by having users login and based on UserID, allow access to certaing .pdf's.
I have tried it a few different ways using different file types and their corresponding contenttype and nothing happens. I even used the same example from microsoft.com and I get "page cannot be displayed"....
I'm trying to create a page that uploads a file. I get an error message saying ADODB object Stream is not available in my server. How do I upgrade my ADODB library?.
I am using the code below to ensure that a download will be sent to the user as a save/open dialog box and not open up in the browser. However I get one of a few different issues.
1. Sometimes the when you click save the box just dissapears and you never get to choose where to save it. And then don't get the file!
2. If you get past the first problem (seems to be unique to pdf's) and can select where you want to save the file, it then doens't actually download the file and the box just dissapears again!
3. If you get past both of these, documents are often corrupt!
Any idea what could be causing these? The server has MDAC 2.8 installed, and it works slightly better on our local testing server Win2k than it does on the live Win2k server! All very odd! Code:
I have an ASP page that downloads file with the ADODB.Stream object. I've found that if the user click cancel in the "Save file as" window or during the downloading, the download is no more available, the page hangs over and and the session have to be closed. (In some cases you have to Cancel more than one time the download process to rise up this error).
I've experienced this problem, as a user, with many major webmail services too!
I have an asp page that needs to display the string that is returned from a cgi file.
As an example, if you enter http://mydomain.com/mycgi.cgi?98127398 in to a browser, it will display YES or NO
I need to have my asp code query this url, get the resulting string, then act upon it (basically use the answer to display a nice big tick or a big cross). Code:
I use the Stream method to serve certain file types to the user. If the type is pdf, it opens in the browser fine. My problem is with those that the browser doesn't have plug-ins such as ppt, word, etc. it prompts to choose Open/Save/Cancel and defaults the filename to the ASP page serving the content. ie. BinarySend.asp -> BinarySend.doc, BinarySend.ppt.
If I use Response.AddHeader "content-disposition", "attachment;filename=" & sFileName then it defaults the filename to the name I specify but always prompt a download instead of opening directly.
Is there another way to default the filename in situation like this?
I use the code below to authorise the download of certain files. Thus, instead of linking to the file in a wwwroot directory, I link to this code with the filename as a parameter, and the script streams the file if the user is authorised.
This has worked fine on PDFs, DOCs, XLS, etc. until today, and 18MB file presents the error message 'format error: not a pdf or corrupt'.
Is there a file size limit, or a default that needs overridden? Any thoughts? Code:
<% dim songs set songs = server.CreateObject("scripting.dictionary") set songs = session("cart") %>
This code works fine in IE but in mozilla/netscape, session object is lost and returns error. However, if i resmove the first line for contenttype, the code works fine in mozilla but i ned the first line as this code is part of playing a window media playlist
It was working fine up until a day or so ago. Now all of a sudden it does not work. If I take out the Response.ContentType line and copy the source code to a asx file it works fine. if I copy the URLs out of the code and put them into the browser it plays. So it is generating the file correctly, it is opening Windows media player, but it then errors saying it cant fine the file. Yet copying the URL from the generated asx works fine.
I am trying to create a report in xls format using ASP. I need to do some formatting to the report. To do this, I'm using xml. But, somehow, I cannot get the columns to autofit causing the report not to print in one page. What am I missing?
I am trying to generate an RSS feed with ASP, however, IE will not display the feed as an XML document, instead returning it as text.
I have <% Response.Buffer = true %> and <% Response.ContentType = "text/xml" %> at the top of the page, but it does not make a difference. Netscape/Mozilla recognizes the contenttype and displays it as XML, and the feed is valid.
from opening the page in excel assuming that excel IS on the clients machine? The page has a couple included pages that contain ASP and JS, the page itself dynamically writes the table cells in html like so...Code:
You know how you can use "Response.ContentType" to tell the browser to display the content as Excel or Word and it will automatically convert your html page into an .xls or .doc file. My question is can I convert it to PDF? If so how?
it is possible to print binary content via response.BinaryWrite! But is it possible to determine as a value? (I get content from another site, they send to me wrong character because of the chracter coding.I want to get it as binary.I can already get, but I can't edit
help me regarding the 'Response.BinaryWrite' I am making one web application where I need to store some of client logo's and others images. In this context I am able to store images into .DB file and even able to display into browser to. But it seems to be 'Response.BinaryWrite' does not support 'html/text' hearder if you user 'BinaryWrite'? I had tried many way to do so but its does not write binary if pages content <html><body> tag's.
I could had done it by uploading images into disk, which is quite simple method and faster too<img src"images/<%=filename%>.jpg/gif"> by having unique file name. But I am not the person who is going to monitor it as user itself has a persmission through the web to have there image as they want to give file name etc. Also I can't have individual directory for each users as if tomorrow users grow then what I suppose to do?
I have a problem in that i have a page that works fine and shows all records/Output until i add Response.ContentType=msword
And then i only show every other record.
I probably should have coded the page differently. But for context - it's a school report system and i have setup a Subroutine which queries a database and builds a summary report for a girl. I wanted to print out a class list of these. I.e one for each girl in a class and so i loop around the results of one recordset and within each loop make a new query and create the report. This is probably not the best way to do it.
Anyhow, in the browser it woorks fine. As soon as i add the code to output it to word (or excel ) i lose evry other report.
I am using Response.BinaryWrite to write a PDF to the browser. Everything works great on IE and Safari but when I try to use Firefox the browser hangs. The title bar says application/pdf but nothing ever shows up. Going directly to the pdf works fine but unfortunately am unable to do that in the long run and must use BinaryWrite.
I have a problem when trying to do response.binarywrite for files > 64kb. I am reading a blob data from the database, this blob data contains files. To read from database ADODB.Recordset is used. I am using the following code to write on to the browser:
This works fine when the blob data is < 64 kb but when this limit exceeds then an error is thrown. how I can go about and read files > 64 kb ? Is there a maximum limit on the size of the file that can be used with response.binarywrite?
I have a commercial database written in access and I'm trying to display some images, jpegs, stored in the DB on web page. My code is as follows:
Response.ContentType = "image/jpeg"
sql = "SELECT PartImage FROM Parts WHERE ShortID='AAPTM01'" Set rs = AMConn.execute(sql) If not rs.eof Then PicSize = rs("PartImage").ActualSize if PicSize > 0 then Response.BinaryWrite rs("PartImage").GetChunk(rs("PartImage").ActualSize) end if End If set rs = nothing
All i get on the page is the image not found icon with the red cross in IE. What could possibly be going on?
Been struggling over this issue for a long while. We store PDF's in our SQL Server database. And I do a BinaryWrite to display the PDF.
It works for me without issue, on FireFox, IE, and Opera! But we are receiving feedback that some users are receiving the file does not begin with %PDF message ....
I'm having some problems with the Reponse.BinaryWrite, IE 6.0 and Adobe Reader 6.0. When I try to write a pdf-file to an IE browser with a Adobe Reader 6.0 installed then it just displays a blank page and the earth on the top rigth corner keeps turning like it haven't read the pdf-file (for 10+ minutes on a lan).
If I change the settings on the Adobe Reader 6.0 to not open in a browser, then it works fine. If I use Mozilla 1.4 then it opens fine as well.It works fine as well with Adobe Reader 5.1. The code looks like this:
[Some code that places the pdf-file in a byte array called vntStream] Response.Clear Response.ContentType = "Application/pdf" Response.BinaryWrite = vntStream Response.end
I have tried to place a Response.Flush after the BinaryWrite, but it just makes the Adobe plug-in say something like "document corupted".
I am using Response.BinaryWrite to display JPEG's to the browser. The problem is that in IE, one particular JPEG is loading very slow. Normal JPEG's take a few seconds, but this one sometimes takes up to 30 seconds. THe weird thing is that if I refresh really quick, the JPEG appears for quick second, and then the new Response.BinaryWrite kicks in. So, it looks like the browser has the image, but for some reason it is not finishing loading it into the browser. Code: