资源描述:
《asp生成sitemap.xml(站点地图)文件的代码(asp generates the code for the sitemap.xml (site map) file)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、asp生成sitemap.xml(站点地图)文件的代码(ASPgeneratesthecodeforthesitemap.xml(sitemap)file)TheSitemapgeneratorGoogle,Ireallydonothaveto,ageneratedonlinesitemap.xmlwebsiteisgood,theaddressishttp://www.sitemapbuilder.net/default.aspx,buttheupdateuptoomuchtrouble,sotheInternettofindapieceofASPcode.Justchangethedoma
2、innameinthecode,generatethedirectory,theexceptionfolder,theextension,andtheseparateexceptionfile(theredpartofthecode).<%@%>CODEPAGE=65001Response.CharSet=UTF-8%><%Response.Buffer=True%><'For,www.cnfgg.com,Sitemaps,XMLServer.ScriptTimeout=50000Session("server")="www.cnfgg.com"domainnameVDir="/""makeS
3、iteMapdirectory,relativerootdirectory,totalstation"/"Setobjfso=CreateObject("Scripting.FileSystemObject")Root=Server.MapPath(vDir)-'D:askmyself''Server.MapPath(vDir)STR=<,,encoding=,UTF-8,>>&vbcrlfSTR=STR&""&"vbcrlf"STR="S
4、TR&--GoogleSiteMapFile!Generatedbyhttp://www.askmyself.cn(now)&"&">&vbcrlfSetobjFolder=objFSO.GetFolder(root)SetcolFiles=objFolder.FilesFor,Each,objFile,In,colFilesSTR=STR&getfilelink(objFile.Path,objfile.dateLastmodified)&vbcrlfNextShowSubFolders(objFolder)STR=STR&""&vbcrlfSetFSO=NothingSe
5、tobjStream=Server.CreateObject("ADODB.Stream")WithobjStream.Open.CharSet="UTF-8"".Position=objStream.Size.WriteText=str.SaveToFileServer.Mappath("/sitemap.xml"),2'generatedXMLfilename.CloseEndWithSetobjStream=NothingIfNotErrThenResponse.Write("Response.EndEndIfSubShowSubFolders(objFolder)SetcolFolders=objFolder.SubFoldersFor,Each,objSubFolder,In,colFoldersIfFolderpermission(objSubFolder.Path)ThenSTR=STR&getfilelink(objSubFolder.Path,objSubFolder.dateLastmodified)&vbcrlfSetcolFiles=objSubFolder.FilesFor,Each,objFile,In,colFil
7、esSTR=STR&getfilelink(objFile.Path,objFile.dateLastmodified)&vbcrlfNextShowSubFolders(objSubFolder)EndIfNextEndSubFunctiongetfilelink(File,datafile)File=Replace(File,root,"","1","-1,1")File=Replace(Fi