Recommended: Use styles, themes, and skins in ASP.NET 2.0 The theme and skin features of ASP.net2.0 enable you to store style and layout information in a set of independent files, collectively called Theme. Next we can apply this theme to any site to change the appearance and feel of pages and controls within that site. Pass
Some time ago, an asp page was very slow to execute, with a lot of visitors, and it was not modified frequently, so it was too lazy to directly make it into static. Every time I had to download it from the server to modify it, I had to find a way to convert the asp page into an htm static page.
I have seen such articles before, but I didn’t care too much. It was difficult to find a suitable one when I really wanted to use it. So after searching online for a long time, I finally found a more suitable code and added my own modifications, as follows:
| The following is the quoted content: <% Function GetPage(url) 'Get the file contents 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 = nothing End Function on error resume next Url=http://www.CuoXIn.com'The page address to be read response.write starts to update the homepage... wstr = GetPage(Url) 'response.write(wstr) Set fs=Server.CreateObject(Scripting.FileSystemObject) 'if not MyFile.FolderExists(server.MapPath(/html/)) then 'MyFile.CreateFolder(server.MapPath(/html/))' 'end if 'The page address to be stored dizhi=server.MapPath(index.htm) If (fs.FileExists(dizhi)) Then fs.DeleteFile(dizhi) End If Set CrFi=fs.CreateTextFile(dizhi) Crfi.Writeline(wstr) set CrFi=nothing set fs=nothing response.write ...<font color=red>Update is completed! </font> %> |
The code is the simplest. Just save it into an asp file. Just set the URL (asp address to be converted) and dizhi (html address to be saved). Generally, these two files are in the same directory to ensure that the image, css, and js work.
Hope it will be useful for those friends who are looking for HTM generated by asp.
Share: Differences and connections between cookies and session mechanisms Specifically, the cookie mechanism adopts a solution to maintain state on the client side. It is a storage mechanism for the session state of the user side, and it requires the user to open the client's cookie support. The role of cookies is to solve the stateless defects of the HTTP protocol. And s