C# - PDF Coming As Text On Browser?
Jun 1, 2010
I am trying to display a PDF from database (byte[]) to user.
I am using code below to render PDF. It is giving me PDF as binary text as shown below. Instead of open in PDF application it is rendering PDF as text.
Response.Buffer = true;
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
//Response.AddHeader("Content-Length", fileToDownload.Length.ToString());
//Response.AddHeader("Content-Disposition", "inline; name=RemoteUserGuide.pdf");
Response.AppendHeader("content-length", fileToDownload.Length.ToString());
Response.ContentType = "application/pdf";
Response.BinaryWrite(fileToDownload);
Response.Flush();
////Response.Close();
Response.End();
UPDATE: Just noticed, this application page is rendering PDF correctly in CHROME, but still displaying text in IE. (don't have FF3 on server to test). Probably its some browser issue?
View 4 Replies
Similar Messages:
Feb 25, 2011
I am a beginner in MVC. I downloaded a project & compiled it. The browser window came. But now when I compile, the browser window is not coming. I am using VS2008.
View 2 Replies
Jan 6, 2010
just i am wondering is it possible to change the text of other than server controls
for example:
<table>
<tr>
<td>SOME TEXT</td>
</tr>
</table>
I want to change the SOME TEXT to its equivalent french text,
because in my project every data comes from database(even the static content)
View 3 Replies
Apr 30, 2010
I have placed the code below on a page. The strange thing is that the "SOME TEXT" string doesnt show up in the page! I do see "upanel" and "pnl":
upanel
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
pnl
<cc1:TabContainer OnActiveTabChanged="TabChanged" ID="tabContainer" runat="server"
ActiveTabIndex="0" OnClientActiveTabChanged="ActiveTabChanged" Width="100%">
<cc1:TabPanel ID="tp1" runat="server" HeaderText="A tab">
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Always">
<ContentTemplate>
SOME TEXT
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
</ContentTemplate>
</asp:UpdatePanel>
HOWEVER, when I view the pagesource, I see this, so the text IS rendered to the browser! What can be happening here?
upanel
<div id="ctl00_CPHCenter_UpdatePanel2">
pnl
<div id="ctl00_CPHCenter_tabContainer" style="width:100%;visibility:hidden;">
<div id="ctl00_CPHCenter_tabContainer_header">
<span id="ctl00_CPHCenter_tabContainer_tp1_tab"><span><span><span id="__tab_ctl00_CPHCenter_tabContainer_tp1">A tab</span></span></span></span>
</div><div id="ctl00_CPHCenter_tabContainer_body">
<div id="ctl00_CPHCenter_tabContainer_tp1">
<div id="ctl00_CPHCenter_tabContainer_tp1_UpdatePanel3">
SOME TEXT
<div>
</div>
View 2 Replies
Mar 1, 2011
i am using jquery first time on my page , one of my user reports me the bug that when he is trying to select something from browser its not working.i think this is a common scenario when user select something from browser and paste in Google for searching purpose.
View 4 Replies
Apr 1, 2011
I want to show a PDF in browser, from which user can select text, showing pdf is very easy i have done this using "pdfviewer" control, now i want to get the selected text which the user selects in the PDF, is there any way to achieve this? i am using asp.net
View 2 Replies
Feb 15, 2012
How to use two textboxes as a login and password fileds so the browser will ask users if thwy want the browser to remember their credentials?
View 6 Replies
Feb 25, 2011
i have an aspx page that loads and displays a text file in a broswer window and it used to work, I made no changes to it and now testing shows additional content appended below the file.
Here is the text file:
testing...
Here is what is displayed:
[Code]....
The additional output looks like the aspx page itself, which has only a close button incase the file load fails.
Here is the apsx page:
[Code]....
Here is the code:
[code]....
View 1 Replies
Jan 14, 2011
I've been tasked with building a screen scraping application, and I'm looking for information on the best way to cope with web pages that would normally require user input and interaction.
Can this be done via standard web / javascript coding. Is there any API that would allow a desktop application to achieve the same effect?
View 3 Replies
Aug 3, 2010
I dont know whether this simple task or not, but I tried to search in google but couldn't find anything.
I've a asp.net form and user enters some data in the text boxes provided. Whenever user submits the form, browser will save that form data. I don't want this form data to be saved in browser. How can I restrict the browser saving this form data without touching the browser settings?
Application is developed using asp.net and normal text boxes are used here.
View 2 Replies
Dec 30, 2010
In an ASP.NET WebForms 2.0 site we are encountering an intermittent bug in IE6 whereby a file download attempt results in the contents of the being shown directly in the browser as text, rather than the file save dialog being displayed. Our application allows the user to download both PDF and CSV files. The code we're using is:
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.AddHeader("Content-Disposition", "attachment;filename="theFilename.pdf"");
response.ContentType = "application/pdf";
response.BinaryWrite(MethodThatReturnsFileContents());
response.End();
This is called from the code-behind click event handler of a button server control. Where are we going wrong with this approach? Edit Following James' answer to this posting, the code I'm using now looks like this:
HttpResponse response = HttpContext.Current.Response;
response.ClearHeaders();
// Setting cache to NoCache was recommended, but doing so results in a security
// warning in IE6
//response.Cache.SetCacheability(HttpCacheability.NoCache);
response.AppendHeader("Content-Disposition", "attachment; filename="theFilename.pdf"");
response.ContentType = "application/pdf";
response.BinaryWrite(MethodThatReturnsFileContents());
response.Flush();
response.End();
However, I don't believe that any of the changes made will fix the issue.
View 1 Replies
Apr 20, 2010
I am creating a website and I want to know that user is coming from where, like from google, bing, asp.net, any other site. Is their any way to find out in asp.net ??
View 1 Replies
Apr 20, 2010
I am creating a website and I want to know that user is coming from where, like from google, bing, asp.net, any other site. Is their any way to find out in asp.net ?
View 3 Replies
Jan 26, 2010
I have opened a site i have made in VB a while ago to get some code out of it and it all comes up in hex. Everything under app data opens fine. But none of the pages do they all come up as hex.
View 1 Replies
Sep 6, 2010
I am calling my business layer project in Web Project. I added refress business layer project to Web. When I call class in BL project, I need to write twice this namespace. I dont know why it is coming.
MyCompanyName.HRHead.DataLayer.MyCompanyName.HRHead.DataLayer.User
I suppose to call
MyCompanyName.HRHead.DataLayer.User
In my BL project I defined all classes namespace is MyCompanyName.HRHead.DataLayer
View 3 Replies
Jan 12, 2011
my previous quesion was answered, but now the same thing that works in IE doesn't work like it should in Firefox.
my C# looks like this:
[code]....
The problem is that this works fine in IE but when I try it in Firefox, after alert D displays "D" the next alert just displays "undefined". I googled around and found some things relating to events but I could not understand nor correctly implement them.
View 1 Replies
Dec 29, 2010
I have created a windows control and hosted it into my web application. I created that because I need to do some system level tasks through web application. The issue is that I need to show a modalpopup on that form and the activex control is coming on top of modal popup, rest is fine.
View 5 Replies
Sep 6, 2010
Does anyone know why this happens?
[URL]
It was running fine and then all of a sudden this message poped up.
View 2 Replies
Jun 10, 2010
I have a website which is in arabic. I am saving the username in cookies and displaying the username in label from cookies. But it is not coming in arabic. When i rum my website locally it works fine but on server it is not working.
My code is
[code]....
View 5 Replies
Jan 8, 2010
I wanna bind atleast 30,000 records in a gridview from a sqlserver table. I want to bind only 50 records at a time with grid view. The grid has also paging and when I click next page then next 50 records should be shown and another next page's click another 50 records.
How can I optimize this thing. I want that If 30,000 records are binding then grid should be work as binded 50 records.
View 4 Replies
Jul 16, 2010
We are using IIS6 and .Net Framework 2.0 for our intranet with Windows and Digest Authentication . We have 2 domains that have access to this intranet. I suddenly have the need to display slightly different content for users from Domain A. The changes are rather trivial (text on a label and and image in a header) but important to our stakeholders.
View 4 Replies
Mar 29, 2010
for SEO purposes, instead of refreshing the page every click of a product, is it possible to click on the product and when the server comes back with the response, to change the URL of the page to reflect the new link to information currently on page?
point is to have ajax redraw the product details portion of the page but have SEO friendly url's displayed so if people want to bookmark the currently selected product, it will bookmark the right url instead of the generic one to access the products page..
For example... here's my entry point:
Products.aspx
product1product2product3 If I were to click product1, the request goes to the server with roducts.aspx?id=product1 but the url is still products.aspx on the response meaning that when people bookmark the product1 item, and they send the link to a friend, the friend always gets the generic product.aspx page.
I'm trying to get around this without refreshing the full page (postback).
View 3 Replies
Jun 23, 2010
I have a website (not web application). I deleted all references in the code to some DLLs and deleted the dlls themselves, but
when I recompile they keep coming back. I tried with resharper and read 100 articles, but I can't get rid of those dlls! )-:
How can I get rid of the DLLs?
View 1 Replies
Jul 8, 2010
I have a simple ViewModel with 3 properties...I have some javascript going on where if a link is clicked, JQuery sets the values for 2 textfields (1 hidden) and a submit button where i process the rest of the Model on [HttpPost] - but for some reason some fields (the ones NOT set by javascript/JQuery) are coming back null - while on the page there is clearly values in them
[Code]....
And my Controller has the HttpGet and HttpPost, and a method that creates the nodes for the JQuery tree.
When you click on a node, this is when some values are set via javascript
[Code]....
View 4 Replies
Feb 17, 2010
Let's say I have two pages on the same ASP.NET C# WebSite:
Page1.aspx does things in the Page_Load event
I navigate to Page2.aspx using the menu
Page2.aspx does some things then Response.Redirect back to Page1.aspx
Page1.aspx cannot do things in Page_Load event this time because it never fires.
I tried to turn off cache declaratively, tried using true for endResponse in my redirect... nothing seems to make a difference.
View 5 Replies