<!#include file=connasp><%
session(count)=
strURL = // & requestservervariables(SERVER_NAME) & _
left(requestservervariables(SCRIPex)len(requestservervariables(SCRIPex))len(/sitemapasp))
dim foolcat
foolcat = foolcat + <?xml version= encoding=UTF?>
foolcat = foolcat + <!Google Site Map File Generated by & return_RFC_Date(nowGMT) & >
foolcat = foolcat + <urlset xmlns=>
foolcat = foolcat + <url>
foolcat = foolcat + <loc> & strURL & /</loc>
foolcat = foolcat + </url>
session(count)=session(count)+
set all_fs = ServerCreateObject(ScriptingFileSystemObject)
set all_folder = all_fsGetFolder(serverMapPath(/))
set all_files = all_folderfiles
for each file in all_files
foolcat = foolcat + <url>
foolcat = foolcat + <loc> & strURL & / & FileName & </loc>
foolcat = foolcat + </url>
session(count)=session(count)+
next
dim jssql
set js = serverCreateObject(ADODBRecordSet)
sql = select * from [要生成的表名] order by sid asc 修改你要生成的数据表名
set js = connexecute (sql)
do until jseof
id=&js(id)& 修改为你的id字段
foolcat = foolcat + <url>
foolcat = foolcat + <loc> & strURL & /xxxasp?Id= & id & </loc> 修改为你的文件名称和id
foolcat = foolcat + </url>
session(count)=session(count)+
jsmovenext
loop
jsclose
set js = nothing
foolcat = foolcat + </urlset>
foolcat = + foolcat +
foolcat = & foolcat &
FolderPath = ServerMapPath(/)
Set fso = ServerCreateObject(ScriptingFileSystemObject)
Set fout = fsoCreateTextFile(FolderPath&\sitemapxml)
foutwriteLine foolcat
foutclose
set fout = nothing
connclose
set conn = nothing
Function return_RFC_Date(byVal myDate byVal TimeZone)
Dim myDay myDays myMonth myYear
Dim myHours myMinutes mySeconds
myDate = CDate(myDate)
myDay = EnWeekDayName(myDate)
myDays = Right( & Day(myDate))
myMonth = EnMonthName(myDate)
myYear = Year(myDate)
myHours = Right( & Hour(myDate))
myMinutes = Right( & Minute(myDate))
mySeconds = Right( & Second(myDate))
return_RFC_Date = myDay& & _
myDays& & _
myMonth& & _
myYear& & _
myHours&:& _
myMinutes&:& _
mySeconds& & _
& TimeZone
End Function
Function EnWeekDayName(InputDate)
Dim Result
Select Case WeekDay(InputDate)
Case :Result=Sun
Case :Result=Mon
Case :Result=Tue
Case :Result=Wed
Case :Result=Thu
Case :Result=Fri
Case :Result=Sat
End Select
EnWeekDayName = Result
End Function
Function EnMonthName(InputDate)
Dim Result
Select Case Month(InputDate)
Case :Result=Jan
Case :Result=Feb
Case :Result=Mar
Case :Result=Apr
Case :Result=May
Case :Result=Jun
Case :Result=Jul
Case :Result=Aug
Case :Result=Sep
Case :Result=Oct
Case :Result=Nov
Case :Result=Dec
End Select
EnMonthName = Result
End Function
%>
sitemapxml生成完毕共生成<%=session(count)%>个文件点击查看<a >sitemapxml</a>文件