下载 aspx 页面并将其另存为 HTML 页面

发布于 2024-09-14 02:22:22 字数 1431 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

定格我的天空 2024-09-21 02:22:22

您是否在本地计算机上查看此网页?
听起来您正在下载 ASPX 页面(如果您只是指定目录路径,则这是允许的),而不是渲染它。

检查您的 IIS 设置并确保:

  • 您的 Web 的起点
    应用程序配置了
  • 该脚本
    执行已
  • 启用
    正确的 ASP.NET 版本。

然后导航到网页(localhost:theportnumber),右键单击并下载渲染的 html。

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.

雨后咖啡店 2024-09-21 02:22:22

<% %> 之间的代码是服务器端代码,不能直接下载。 Web 服务器根本不会通过它——所以你想要的甚至是不可能的。

在浏览器中查看时,您可以“查看源代码”并将其另存为 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.

泼猴你往哪里跑 2024-09-21 02:22:22

看来你不懂aspx。您会看到,.aspx 页面是 Microsoft 网页格式。它们可以包含 html,但它们与.aspx.cs 文件一起使用,这些文件被称为“代码隐藏”页面,并且只能在服务器上找到。它们包含实际的代码,就像 Java 应用程序一样。 .aspx 页面可以使用指令调用 .aspx.cs 页面,这些指令是奇怪的括号符号 <%%> 你看。

因为 .aspx 页面是 C# 代码和 html 代码(有时还有 asp 元素)的混合,它不会直接转换为您想要的 .html 代码。

您可以执行一些操作,例如

File --> Save Page As

查看页面时,应该下载网页的 html 部分。它不会下载 C# 代码(在服务器上处理)。

如果您通过浏览器的下载管理器下载文件并且需要 html,则必须自己手动删除与 C# 相关的代码。

HTML .aspx 用于静态页面,C# .aspx.cs 用于动态内容。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文