开发者

Download and save aspx page as HTML page [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question?开发者_运维技巧 Add details and clarify the problem by editing this post.

Closed 7 years ago.

Improve this question

How to download the aspx page as a HTML page? I have used download code that downloads me the aspx page as HTML. But when I 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 proper 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 an HTML file in desktop.


Are you viweing this web page from your local machine? It sounds like you're downloading the ASPX page (which would be allowed if you were just specifying a directory path), instead of rendering it.

Check your IIS settings and make sure that:

  • the starting point for your web app is configured
  • that script execution is enabled
  • that it is the correct ASP.NET version.

Then navigate to the webpage (localhost:theportnumber), right click, and download the rendered html.


The code between <% %> is server-side code and cannot be downloaded directly. The web server simply won't pass it--so what you want is not even possible.

When viewing in a browser, you can "View Source" and save this as HTML, but again, any server-side code will not be available.


It seems you don't understand aspx. You see, .aspx pages are a Microsoft webpage format. They can contain html, but they are used in conjunction with .aspx.cs files which are called "code behind" pages and are found only on the server. They contain actual code, like a java application would. The .aspx page can make calls to the .aspx.cs page using directives, which are the weird bracket symbols <% and %> you see.

Because .aspx pages are a mix of C# code and html code (and sometimes asp elements), it does not directly translate into .html code which you want.

There are some things you can do, such as

File --> Save Page As

when viewing the page, which should download the html portions of the webpage. It WILL NOT download the C# code (which is processed on the server).

If you are downloading the file through your browser's download manager and you want the html, you will have to manually remove the C#-related code yourself.

HTML .aspx is for static pages, C# .aspx.cs is for dynamic content.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜