将 html 转换为 aspx

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2701405/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:49:42  来源:igfitidea点击:

Convert html to aspx

htmlasp.net

提问by zeusmos

Is there any tool or code to convert HTML files to .ASPX?

是否有任何工具或代码可以将 HTML 文件转换为 .ASPX?

Elaboration to earlier question: I am looking for tool or code that automatically converts HTML controls to .ASPX server controls without having to manually change each control, i.e., something that will take an HTML page as input, parse, and output as an .ASPX page with server controls.

对先前问题的详细说明:我正在寻找能够自动将 HTML 控件转换为 .ASPX 服务器控件而无需手动更改每个控件的工具或代码,即,将 HTML 页面作为输入、解析和输出为 .ASPX 的内容带有服务器控件的页面。

回答by Justin Niessner

No conversion needed. Just change *.html to *.aspx.

无需转换。只需将 *.html 更改为 *.aspx。

If you want parts of the HTML page to become dynamic, there's more work involved then.

如果您希望 HTML 页面的某些部分变得动态,那么就需要做更多的工作。

回答by Robert Greiner

No, ASP.NET code is embedded in your regular HTML code, so your default web pages will have the extension .aspx but there are a few other things you need to do to get a ASP.NET site up and running.

不,ASP.NET 代码嵌入在您的常规 HTML 代码中,因此您的默认网页将具有扩展名 .aspx,但您还需要做一些其他事情来启动和运行 ASP.NET 站点。

Check out this link with some help on how to get started with ASP.NET
http://www.asp.net/get-started/

查看此链接,了解有关如何开始使用 ASP.NET 的一些帮助
http://www.asp.net/get-started/

Also, here's one of my favorite bookson the subject that really helped me learn more about ASP.NET (you might want to find a version 4.0 book though if you are working with the new features of ASP.NET.)

此外,这是我最喜欢的关于该主题的书籍之一,它确实帮助我了解了有关 ASP.NET 的更多信息(如果您正在使用 ASP.NET 的新功能,您可能想要找到一本 4.0 版的书。)

回答by Mano

Its very simple to convert .htmlto .aspx

转换.html为非常简单.aspx

if you just change the extension from .htmlto .aspx,

如果您只是将扩展名从 更改.html.aspx

  1. Sometimes it leads to some unexpected exception handling, that says as , file cannot open or corruptedYou will just have the filename.aspxpage(design and source) BUT WILL not get the filenmae.aspx.vbpage(coding).
  1. 有时它会导致一些意外的异常处理,也就是说,file cannot open or corrupted您将只拥有filename.aspx页面(设计和源代码),但不会获得filenmae.aspx.vb页面(编码)。

So better follow these steps :

所以最好按照以下步骤操作:

  1. Open the .htmlfile in a notepadand copy the contents.

  2. Create a new webformin visualstudio(with masterpage)

  3. Goto sourcepage and erase the default contents and paste the copied contents
  4. Save it. execute it .
  1. 打开 a 中的.html文件notepad并复制内容。

  2. 创建一个新webformvisualstudio(带有母版)

  3. 转到source页面并删除默认内容并粘贴复制的内容
  4. 保存。执行它。

Note(Imp):Do not forget to keep ur webform controls, jscripts, css(stylesheets), images(if any)within the project created

注意(Imp):不要忘记将 ur webform controls, jscripts, css(stylesheets),保留images(if any)在创建的项目中