简体   繁体   中英

how to render a .htm page into .aspx page

i have aspx page which has to render .htm page how can it be done

if possible then i want added feature that is i want to call a JavaScript after that .htm page is rendered

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.

Another option, if you can have that file only include the html inside the body, is to load it in a literal control. Then you have the regular options to send / have the intended script to be ran at page load.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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