简体   繁体   English

如何将.htm页呈现为.aspx页

[英]how to render a .htm page into .aspx page

i have aspx page which has to render .htm page how can it be done 我有必须渲染.htm页面的aspx页面怎么办

if possible then i want added feature that is i want to call a JavaScript after that .htm page is rendered 如果可能的话,那么我想要添加的功能是在渲染.htm页面后调用JavaScript。

pls help 请帮助

If you were to just serve the original file, you could: 如果只提供原始文件,则可以:

Response.Clear();
Response.WriteFile(localPathToHtmFile);

As you instead want to modify it, and assuming you need to stick to the full file, then you'd have to do some light parsing of it to add the script you want ran when the page is loaded in the browser. 当您要修改它时,并假设您需要坚持完整的文件,那么您必须对其进行一些浅析浅析,以添加要在页面加载到浏览器中时运行的脚本。 Instead of using WriteFile, you'd write the modified string to the response. 无需使用WriteFile,而是将修改后的字符串写入响应。

Another option, if you can have that file only include the html inside the body, is to load it in a literal control. 如果可以让该文件仅在主体内包含html,则另一种选择是将其加载到文字控件中。 Then you have the regular options to send / have the intended script to be ran at page load. 然后,您可以使用常规选项来发送/使预期的脚本在页面加载时运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM