开发者

How to convert aspx page into html page?

I have designed my web page in asp.net its in aspx page. i need to covert it into html page .Because my server not support .aspx p开发者_运维问答age help me to solve this issue


Open it on your local machine in a browser, view the source (View | Source in IE, View | Page Source in Firefox etc ), then save that page source as pagename.html.

Obviously you'll lose any asp.net page methods etc.


  1. Remove all the server side code
  2. Rename the file

or

  1. Open in web browser
  2. Pick Save As


put it on a server that supports asp, and then view the source and copy to a static html file


That is not a good idea, if I understand you right.

HTML files are static - the only processing allowed is on the client machine, via javascript.

ASPX files are dynamic, there is processing on the server each time the page is loaded or interacted with by the user, and this generates HTML which is passed to the client browser.

If you convert your ASPX to HTML you will lose all the dynamic elements of the page. Try it: Load your ASPX page in the browser and right click. Select "View Page Source (or whatever your browser calls it) and save that to you local HDD. You can load it, and it will look like your page, but nothing will actually work.


Powershell way:

$cred = Get-Credential # if required
$aspxpage = Invoke-WebRequest -Uri $uri -Credential $cred
$aspxpage.Content > "test.html"

It may be useful on more complex use cases to process many pages.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜