C# - Download And Save Aspx Page?

Aug 13, 2010

I saved aspx page as html it worked in my local machine but after published on the server its showing an error that "the access to the path is denied"... I tried giving access permission then also it doesn't work.. or else is there any other way to save the page in C# asp.net?...

string url=HttpContext.Current.Request.Url.AbsoluteUri;
string sHtml="";
HttpWebRequest request;
HttpWebResponse response=null;
Stream stream=null;
request=HttpWebRequest)WebRequest.Create(url);
response=(HttpWebResponse)request.GetResponse();
stream=response.GetResponseStream();
StreamReader sr=new StreamReader(stream,System.Text.Encoding.Default);
sHtml=sr.ReadToEnd();
string path=Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string textfilename=TextBox1.Text;
string getpath=path+"\"+textfilename+".html";
File.WriteAllText(getpath,sHtml);
if(stream!=null)stream.Close();
if(response!=null)response.Close();

View 3 Replies


Similar Messages:

C# - Download And Save Aspx Page As Html Page?

Aug 12, 2010

how to download the aspx page as a html page. i have used download code that downloads me the aspx page as html. but i when open the file saved in my desktop it is showing the format as <@page directive.....> and oly<% %> <% %> <% %> <% %> <% %> <% %>

this tags are coming. how should i resolve this problem and get the page download / saved in propr html format.

i have a aspx page which is giving me some customer details in web browser. i need to save the web page as a html in desktop.

View 2 Replies

Web Forms :: Save (Download) ASPX As Word Document

Jun 22, 2013

I have designed a aspx page and I need to save the page in word document.

View 1 Replies

C# - PDF Download From Aspx Page?

Nov 12, 2010

I have a page that when a user clicks a button, a PDF is dynamically generated and offered for them to download.This is the code that's letting the user download the pdf:// Omitted code that generates the pdf bytes

response.ContentType = "application/octetstream";
response.AppendHeader("Content-Disposition", "attachment; filename=" + filename);
response.BinaryWrite(pdfBytes);
response.End();

On my machine and many others using a mixture of Chrome, IE 7/8/9b and Firefox, this is working as expected; the user clicks the button, the PDF gets downloaded.On some instances of IE7, our users are reporting that they are getting an error message:"Internet Explorer cannot download Publish.aspx from thesite.comInternet Explorer was not able to open this Internet site. The requested site is either not available or cannot be found. Please try again later".Publish.aspx is the page that the button is residing on, so that page is available. IE should be downloading the pdf.Is there anything that is wrong with the above code that could be causing this on certain machines? Or is it down to particular security / OS / browser settings?EDIT:These are the response headers from fiddler:

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Content-Type: application/octetstream
Expires: -1
Server: Microsoft-IIS/7.5
Content-Disposition: attachment; filename=myPdf.pdf
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Fri, 12 Nov 2010 09:48:06 GMT
Content-Length: 45772

View 7 Replies

Web Forms :: Download And Save PDF File Without Save Cancel View Dialog Box?

Feb 16, 2013

can we save pdf document without save,view,cancel dialogue box in asp.net..

View 1 Replies

Web Forms :: Page Aspx Download Itself (on FF3) Running At Server But Not At Development Time

Apr 19, 2010

I have a webform that has a master page. In the web form I have a dropDownList it has PostBack=True, cause every time I changed the option I concat paratemer (item choosen) at hyperlink's navigate url property, for example I have 2 items:

id text
1 Option1
2 Option2

If the users select Option1 then concat at the url "?option=1" The problem is, that when I choose one option and then click at hyperlink everything goes right, but at the second time I choose an option the browser try to download de page itself aspx. update: even if I click at other hyperlink or link button after choose an option and click the hyperlink, the same thing happens (the browser ask me for download the page aspx)

I have no idea how to avoid this behavior at browser and it happens just at server with the IIS not while I'm testing at VS2008, update: ah I almost forget, if I click "cancel" at the prompt of firefox, then everything goes right again, until the next time I choose other option and click at the hyperlink, then everything goes wrong again...

Update (Code):

[Code]....

And here is the ASPX page

[Code]....

View 10 Replies

Save Aspx Page As .mht (Web Archive)

Mar 5, 2010

Is it possible to give the user the option (on a button click) to save the current aspx page as a web archive?

View 6 Replies

Save .aspx Page As .JPG Image?

Jan 29, 2010

I want to convert .aspx page content to .JPG image means like we take screen shot of page and save as image but i want whole page should save as image and based on that i want to generate PDF for that Page.

View 3 Replies

How To Save Aspx Page Into MS Word

Jul 23, 2010

I have a requirement where the customer wants to save their web page into MS Word. Can someone show how I can save the page they are on, which they want to save into MS Word?

View 1 Replies

Web Forms :: Save Page Values In Aspx Page?

Jan 24, 2010

In my website I have a search page.After clicking on the search button,in the search page,the navigation goes to the result page.

On clicking back button when the user again comes to the search page,the search query is sometimes lost and sometimes saved.

The query is saved if the user goes back immediatly while the query is lost if the user goes back after 10-15 minutes.

I need to keep the search query for a long time ,say 30 minutes.

View 8 Replies

Web Forms :: Save A Div As A Picture (aspx Page)?

Feb 6, 2011

Using C#

How can i save a Div (tabel) in .aspx page as a Pic (jpeg or anything) ?

View 2 Replies

Web Forms :: How To Save A Copy Of ASPX Page

Jan 27, 2010

How can I save a copy of my current ASPX page (both in memory or and in a temp folder) so that I may render that page later using HtmlTextWriter?

View 3 Replies

C# - How To Save Current Aspx Page As Html

Jul 17, 2010

how to save current page as a html page on button click. My page contains only labels which I fill on page load event.

I am using the code below for this, but it's not saving (in HTML) all of the values that I see when my page is loaded (I think it converts before the values get loaded on the page).

[Code]....

View 1 Replies

Controls :: Convert ASPX Page To PDF File And Save It On Servers Disk?

Feb 22, 2013

i convert my webpage into pdf file in vb.net

i want to save that pdf file in a specific folder in any drive (C: or D:)

how can i give a path in the below coding

Response.Buffer =True
Response.ContentType ="application/pdf"
Response.AddHeader("content-disposition", String.Format("attachment; filename={0}.pdf", Me.psno.Text))
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Dim sw AsNew StringWriter()

[Code].......

View 1 Replies

Controls :: How To Convert ASPX Page To PDF File And Save It On Server Disk

Oct 4, 2012

How I convert aspx page to pdf file with images.

View 1 Replies

HttpHandlers / Modules :: Redirect Shareware Download URL From A File To A Download Page?

Oct 13, 2010

I'm about to submit my pad file to multiple sharware sites but the pad file has to have a direct link to the download file and can't link to a download page which is what I would like to do, so I can track the traffic and get the downloader's email before allowing the download. I am running an ASP.NET site in VB. Is there a way to tell the web app to redirect to a specific aspx page when it receives a request for a specific file?

View 1 Replies

Download Pdf Document In Save As Dialog

Nov 3, 2010

I am using following code for download pdf in save as dialog but there is problem in IE,

[Code]....

View 3 Replies

Can Download PDF Document On Save As Dialog

Nov 3, 2010

I am using following code for downloading PDF document in save as mode but there is a problem in IE,

private void DownloadFile(string fname, bool forceDownload)
{
string path = MapPath(fname);
string name = Path.GetFileName(fname);
string ext = Path.GetExtension(fname);
string type = "";
[code]...

View 1 Replies

Download PowerPoint File With Save As?

Sep 22, 2010

I'm generating a PowerPoint file using this as reference. A user can search other users based on many criterias. Information based on the user is saved in the PowerPoint file. But I can't save all PowerPoint files on the server.So, the user needs to right click a link, choose "Save As...", and save the file locally.

Nothing should be saved on the server. I have been Googling, but I'm not sure what to look for.I seems I am a bad googler. I removed "powerpoint" from my search string, and there are a lot of hits.

View 1 Replies

C# - Use Save Dialog Box For Download Files?

Nov 25, 2010

in my project i have a folder containing N number of files. I need a functionality that the page should have links for all those files so that client can download those files.

For this i have dynamically created Link Buttons and linked each file with each link Button.

The Code is as

string filePath = Request.PhysicalPath.Substring(0, Request.PhysicalPath.LastIndexOf("\"));
filePath = filePath.Substring(0, filePath.LastIndexOf("\"));
filePath = filePath.Substring(0, filePath.LastIndexOf("\")) + "\Export";
string[] files = System.IO.Directory.GetFiles(filePath);

[Code]...

But the problem is that, when i am trying to download this:


the file is downloading in HTML format, moreover the file name of downloaded file becomes same to my Code file name where as i want the actual name. the downloaded file have the actual data but it also contains the html code to the page on which this links are coming

View 2 Replies

C# - Unable To Open Download Save Dialog

Dec 23, 2010

Using the below code I am unable to show the open/save as file dialog:

[code].....

View 2 Replies

Web Forms :: Handler Download/save Instead Of Open It?

Jan 23, 2011

I've build a handler with this coding in it:

[skipped some not interesting code]
myConnection.Open();
SqlDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);

[code]...

View 2 Replies

Web Forms :: Save And Download QR Code Image

Mar 26, 2016

This code working fine but how to save this QR Code in Folder as Image format?? Actually I want to print every employee form with QR code Separately. I am using VS 2010 with vb language.

Imports QRCoderImports System.IOImports System.Drawing

Partial Class VB Inherits System.Web.UI.Page Protected Sub btnGenerate_Click(sender As Object, e As EventArgs)
Dim code As String = txtCode.Text Dim qrGenerator As New QRCodeGenerator()
Dim qrCode As QRCodeGenerator.QRCode = qrGenerator.CreateQrCode(code, QRCodeGenerator.ECCLevel.Q) Dim imgBarCode As New System.Web.UI.WebControls.Image() imgBarCode.Height = 150 imgBarCode.Width = 150

[Code] ....

View 1 Replies

Web Forms :: Dynamically Save An Image To The Server And Download It

Aug 11, 2010

i have a requirement where user can edit the image in the flash tool runtime and i am saving the image to the server ...but now i have to give the option to save the same image to the localhost.one more thing is i am passing the parameters frm the flash tool to another page and doing all the operations on that page like save and download.

check the below link

http://www.sunscopeusa.com/Pages/product.aspx?isSubCat=0&cat=7&pid=419

here click on the add your logo link then in the logo tab you can upload any logo from localhost then on the save tab i have to save the image to the server and then download it but both should be done at the same time i have done the save code but unable to downlaod it.

View 1 Replies

How To Open / Save Dialog In Browser When Download A Pdf File In C#

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







Copyrights 2005-15 www.BigResource.com, All rights reserved