C# - Save A PDF That's Been Streamed To The Browser?
May 19, 2010
I'm streaming PDFs to the browser, and it works fine. The problem is when someone clicks the save button. On the same server, we have a "Live" and a "test" site. They are identical, and I've verified that all code is identical. However I'm seeing different dialog boxes when the user clicks "Save"
Test site:
- dialog box: "Save A Copy"
- file name: "Document.pdf"
- file type: Adobe PDF
Live site:
- dialog box: "Save As..."
- file name: "Document.aspx"
- file type: Adobe PDF
To make things even more "fun" I've noticed this behavior ONLY with IE8. With Firefox or Chrome clicking save - regardless of which site (test or live) opens the "Save a Copy" dialog box which allows the users to save the file as a PDF instead of a .aspx file.
View 1 Replies
Similar Messages:
Aug 25, 2010
I am trying to get this to work for quite some time now. I have an asp.net page in which I am trying to play a wav file. The code in the page load event is as follows:
Response.Clear()
Response.ContentType = "audio/wav"
Response.AppendHeader("Content-Disposition", "inline;filename=" + "temp.wav")
Dim filePath As String = Server.MapPath("/temp.wav")
If Not String.IsNullOrEmpty(filePath) Then
'Here I am converting the file to a byte array,as eventually I'll be creating the wav files on the fly
Dim fileBytes As Byte() = GetFileBytes(filePath)
Response.BinaryWrite(fileBytes)
Response.Flush()
End If
The problem I am having is every time I run this page, the windows media player opens up. I would like the audio to be played using some inbuilt plugin in the browser. Something like, when you click on a voice icon, how the sound pops up without opening any player.
If I have the same content in an ashx handler, would it be better?
I could not use the embed tag because, I shall not be having a physical file on the server, it would be generated on the fly using a response stream.
View 1 Replies
Jan 18, 2010
I've got an aspx page that streams jpeg's. It sets the content type and then writes to the response stream. If I view the images directly they work a treat, but if I use fancybox 1.2.6 I get the following.Using fancybox 1.2.1 the images do show.Here is the code that is pushing out the image.
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (Stream responseStream = response.GetResponseStream())
[code]...
View 3 Replies
Jan 3, 2011
I have an ASP.NET Web Forms application. I want to have a button to post back to the server that will use my fields on my form (after validation) as parameters to a server process that will generate a document and stream it back to the browser. I want the form to be updated with some status results.
What is the best way to achieve this? Right now, I've got the button click generating the document and streaming it back tot he browser (it's a Word document and the dialog pops up, and the Word document can be opened successfully) but the page doesn't get updated.
View 2 Replies
Mar 8, 2011
I set ASP.Net ViewState to off for a text box control, but the value for the name of the user is still there. Why is this so?
View 3 Replies
Jun 3, 2010
I am streaming HTML content into a Literal control in an ASPX page, and am continually running into a problem where the page loads fine the first time I try it, then subsequent attempts fail to load.
The purpose of the aspx page is to act as a 'broker' to another process that produces streamed HTML output, which then needs to be resolved by the browser.
The reason I'm not just using HtmlTextWriter to stream out the code to the Response object is that the streamed HTML contains framesets, and I am forbidden from modifying that code in any way, so I must keep the streamed code intact. In spite of the fact that frameset HTML hardcoded into the ASPX file would work, it does NOT resolve streamed frameset code!
In any case, streaming into the literal (by creating a string that is assigned to the Literal's Text property) works just fine -- the FIRST time I load that page. If I exit the page, then try to reinstantiate, it FAILS, producing an empty HTML file (containing only "<HTML></HTML>").
View 3 Replies
Aug 31, 2010
I have a WCF service that returns a stream object. But for some reason i get a corrupt zip file back which i am streaming.
Contract Code
[ServiceContract(Namespace = "http://schemas.acme.it/2009/04/01")]
public interface IFileTransferService
{
[OperationContract(IsOneWay = false)]
FileDownloadReturnMessage DownloadFile(FileDownloadMessage request);
[Code].....
View 2 Replies
Apr 7, 2010
I want to save log out time when user close the Browser without clicking log out button using asp.net with C# and SQL server 2005.
kindly let me know the way as well as code..
View 3 Replies
Mar 22, 2010
I am thinking about opening a PDF file with some editable fileds in the browser , by which i can modify the PDF file / fill information etc and then save that PDF FORM
View 7 Replies
Aug 4, 2010
I have a mail list where i can select many mails and download (with/without opening the mail). During the download process i update the mail status(download/open) and show the content in pdf. In normal browser dialog opens where user can save open or cancel options exits. But if the user cancel then the update process done on the mail should not happen. so i think about doing the update process if the user clicks open or save but how can i identity that client control (i think it depend on the browser)
The issue is present if i download and unopened mail and click cancel button in the dialog box the pdf creation code i have done is in this link
[URL]
which i used to open that dialog in browser to save pdf
View 2 Replies
Feb 15, 2011
I have a requirement to disable save as and print options of file menu of the browser in which my portal opens.For this i have used javascript code which clears the clipboard text.Because of this when my pplication is opened then copy paste wont work on the system.Iam calling this method on load of a startup page and afer clearing the clipboard text iam opening my home page through javascript with no menu bar just like a modal popup iam trying ot open.This is working fine for some browsers but IE7 and firefox users are unable to load the applicatio because of this javascript function.Can anyone suggest me how to overcome this or how to disable save as and print option.My final aim is user shouldnt be able to save or print my application data...
View 5 Replies
Feb 15, 2010
Is that a way to edit excel file on browser and then save it on server?
View 5 Replies
Nov 12, 2010
I have a VS 2008 asp.net c# application and a Login web page with a
Login Control from:-
System.Web.UI.WebControls.Login
Ive notice that some browsers (may be all) prompt to save the user login information when they first try the Login.
How can I stop this?
Ive read many solutions, one being setting the Username & Password TextBox controls to blanks.
View 6 Replies
Feb 25, 2016
[URL] ....
By using above query its fine to save logout time in database, if the user unfortunately close the browser without logout then how to store logout time in database...
View 1 Replies
Mar 30, 2010
Is there a good way to keep the session after a user clicked reload/refresh? My boss wants this functionality, and I don't really/really don't want to use a query string...
View 2 Replies
Feb 26, 2010
Can I save a page position in browser after clicking button or some other actions (after PostBack)
I need it on Page Change event in my DBGrid like on msdn.microsoft.com - when I change Tab C# -> C++ for example it doesn't refresh whole page and I still being on same position in browser.
View 1 Replies
Jul 17, 2015
I am getting location by latitude and longitude from geolocation but location is not showing, If I pass latitude and longitude manually than its working good where is error in my code plz check my code.
<form id="form1" runat="server">
<script src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
[Code] .....
View 1 Replies
Apr 22, 2013
Is it Possible to save the data from repeater to the database when we unloading the page(Like clicking other menu or closing the page)
View 1 Replies
Feb 22, 2013
I have created a pdf file using aspose and need to open it without saving the pdf.Is it possible.
View 1 Replies
Dec 13, 2010
I have window form to let user fill data, I want to alert user if close web browser before saved web form data, could anyone provide any clue?
View 5 Replies
Feb 9, 2010
I have website home page which my client can view well on his blackberry mobile phone but I have link buttons on that page which redirect the users to other pages ..just Response.Redirect ............simple code.... but when he clicks on the link, it requests for enabling javascript..I do that but the home page just does a postback. Links are not working on cellphone........... on regular website they are working fine.
View 2 Replies
Dec 14, 2012
I used javascript code to open popup window.Popup window "Maximize" button is in
disable state.But in Chrome it is in enable state.I want to make browser maximize button disable.
Below is my javascript code
function Call_PopUp(event, URL) {
window.open(URL, 'CustomPopUp', 'width=990, height=540, menubar=no,scrollbars =yes, resizable=no, top=50,left=50,toolbar=no,dialog=yes,minimizable=yes,maximizable=no');
}
View 1 Replies
Apr 25, 2010
i need to get the Browser version, type of the user. i need the short name not the long one.
at the monent i have this:
browser = Request.ServerVariables("HTTP_USER_AGENT") that retuens this:
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249
i need only (Chrome/4.1.249), (MSIE 8.0)...............
plus i would like to get the operating system too
View 16 Replies
Jun 18, 2013
I have a web application that runs via IIS 7 what i want to do with the application (Asp.net with C#) is only load if the browser is greater than IE9, or greater than or equal to Chrome27 or greater than or equal to firefox19.
How to do this or areas i should read to do such a thing?
View 1 Replies
May 7, 2015
How To Save Video files into folder and save path only into database in asp.net using c#.
View 1 Replies