Convert the ASP page to HTM page

xiaoxiao2021-04-04  233

There is a very slow period of time, and the number of visitors is very slow, and the number of visitors is quite, and it is not often modified. It is too lazy to do it directly. Every time you have to change it, you have to change the ASP page into HTM. Static page. . .

I used to see such an article, but I didn't care too much. It's hard to find a suitable code when I really want to use it, so I finally found a relatively suitable code and add my own modification, as follows:

<% Function getPage (URL) 'Get file content DIM RETRIEVAL SET RETRIEVAL = CreateObject ("Microsoft.xmlhttp") with retrieval .Open "Get", URL, FALSE', "," "" .send getpage = bytestobstr (.RESPonsebody ) End with set retrieval = Nothing end function

Function BytesToBstr (body) dim objstream set objstream = Server.CreateObject ( "adodb.stream") objstream.Type = 1 objstream.Mode = 3 objstream.Open objstream.Write body objstream.Position = 0 objstream.Type = 2 objstream.Charset = "GB2312" bytestobstr = objstream.readtext objstream.close set objstream = Nothingend Function

ON Error ResMe NextURL = "SET FS = Server.createObject (" scripting.filesystemObject ")

'if not myfile.folderexists (Server.mAppath ("/ html /")) Then' myfile.createfolder (Server.MAppath ("/ html /")) '' endiff

'The page address to be stored dizhi = server.mappath ("index.htm") IF (fs.fileexists (dizhi)) thenfs.deletefile (dizhi) endiff

Set crfi = fs.createtextFile (dizhi) crfi.writeline (wstr) set crfi = NothingSet fs = nothingResponse.write "... update complete! "%>

The code is the easiest, directly saved as an ASP file, just set the URL (to which the ASP address to be converted) and Dizhi (HTML address to be saved) can be set, and the two files are in the same directory, Can guarantee pictures or CSS, JS work.

I hope to use friends who are looking for asp-> htm. '

转载请注明原文地址:https://www.9cbs.com/read-131803.html

New Post(0)