【问题标题】:How can i format aspx-markup as html to show it on webpage我如何将 aspx-markup 格式化为 html 以在网页上显示
【发布时间】:2026-02-05 11:05:02
【问题描述】:

我一直在使用 C. Coller 的出色 CopyAsHtml-Visual Studio addin 将 C# 代码作为 html 复制到网页。

现在,我开始怀疑是否有类似的工具可以将 aspx 标记转换为有效的 html 以显示在页面上?我正在寻找的功能可以在G. Houston's blog 上看到。

F.ex.如果我喂这个

<asp:Button id="btnSthing" runat="server"></button>

进入上面链接中的工具,它会为我生成以下内容:

<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color:     
#000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 
14px;padding: 5px; overflow: auto; width: 100%"><code>&lt;asp:Button id=&quot;
btnSthing&quot; runat=&quot;server&quot;&gt;&lt;/button&gt;</code></pre>

我可以简单地将其复制并粘贴到网站中以显示使用的 aspx 标记。

如果有这种功能的工具可以集成到 VS 中,我很想听听!其他实现此效果的方法也将不胜感激!

问候, J.阿罗拉

【问题讨论】:

    标签: asp.net markup visual-studio-addins html-generation


    【解决方案1】:

    我不知道有这样一个用于 VS 的工具,但以下网站允许您使用 HTML 格式的多种语言(C#、Java、PHP、XML、HTML、ASPX)的源代码: http://codeconverter.sharpdevelop.net/FormatCode.aspx

    【讨论】:

      最近更新 更多