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.
<% %> 之间的代码是服务器端代码,不能直接下载。 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.
因为 .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.
发布评论
评论(3)
您是否在本地计算机上查看此网页?
听起来您正在下载 ASPX 页面(如果您只是指定目录路径,则这是允许的),而不是渲染它。
检查您的 IIS 设置并确保:
应用程序配置了
执行已
正确的 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:
app is configured
execution is enabled
the correct ASP.NET version.
Then navigate to the webpage (localhost:theportnumber), right click, and download the rendered html.
<% %> 之间的代码是服务器端代码,不能直接下载。 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.
看来你不懂aspx。您会看到,
.aspx
页面是 Microsoft 网页格式。它们可以包含 html,但它们与.aspx.cs
文件一起使用,这些文件被称为“代码隐藏”页面,并且只能在服务器上找到。它们包含实际的代码,就像 Java 应用程序一样。.aspx
页面可以使用指令调用.aspx.cs
页面,这些指令是奇怪的括号符号<%
和%>
你看。因为
.aspx
页面是 C# 代码和 html 代码(有时还有 asp 元素)的混合,它不会直接转换为您想要的.html
代码。您可以执行一些操作,例如
在查看页面时,应该下载网页的 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
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.