在asp编程中,我们有时候会遇见获取当前页面名称,怎么做呢,其实系统已经给我提供了服务器变量,能够轻轻松松通过asp获取当前页面名称,直接上代码,复制下面的代码,放在程序中, call getPageName() 调用就好。
'
'//函数:获取当前页面名称
'//参数:无
'//返回:getPageName()
Function getPageName()
Dim fileName,arrName,postion
fileName=Request.ServerVariables("script_name")
postion=InstrRev(fileName,"/")+1
fileName=Mid(fileName,postion)
If InStr(fileName,"?")>0 Then
arrName=fileName
arrName=Split(arrName,"?")
filename=arrName(0)
End If
getPageName=filename
End Function