获取页面名称 [英] getting the page name

查看:103
本文介绍了获取页面名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何申请我所在的实际页面名称?这将是一个包含文件的

,根据我在哪个页面上,我想做不同的事情。

。我正在寻找pagename.asp

How do I request the actual page name that I''m on? This is going to go into
an include file, and depending on which page I''m on, I''d like to do
different things. I''m looking for "pagename.asp"

推荐答案

从SCRIPT_NAME服务器变量中提取它。


<%


Response.Write GetFilename


函数GetFilename

Dim sPath,aParts

sPath = Request.ServerVariables(" SCRIPT_NAME")

aParts =拆分(" /"& sPath," /")

GetFilename = aParts(UBound(aParts))

结束功能

%>


Ray at work


" middletree" < MI ******** @ htomail.com>在留言中写道

新闻:%2 **************** @ tk2msftngp13.phx.gbl ...
Exract it from the SCRIPT_NAME server variable.

<%

Response.Write GetFilename

Function GetFilename
Dim sPath, aParts
sPath = Request.ServerVariables("SCRIPT_NAME")
aParts = Split("/" & sPath, "/")
GetFilename = aParts(UBound(aParts))
End Function
%>

Ray at work

"middletree" <mi********@htomail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
怎么做我请求我的实际页面名称?这将是
到一个包含文件,根据我在哪个页面,我想做不同的事情。我正在寻找pagename.asp
How do I request the actual page name that I''m on? This is going to go into an include file, and depending on which page I''m on, I''d like to do
different things. I''m looking for "pagename.asp"



strPageName = Request.ServerVariables(" SCRIPT_NAME")&如果instr(strPageName," /")> 0则

strPageName = right

instrRev(strPageName," /"))

结束如果

response.write strPageName


干杯

史蒂夫

" middletree" < MI ******** @ htomail.com>在消息中写道

新闻:#8 ************** @ tk2msftngp13.phx.gbl ...
strPageName = Request.ServerVariables("SCRIPT_NAME") & "<br>"
if instr(strPageName,"/")>0 then
strPageName = right(strPageName, len(strPageName) -
instrRev(strPageName,"/"))
end if
response.write strPageName

Cheers
Steve
"middletree" <mi********@htomail.com> wrote in message
news:#8**************@tk2msftngp13.phx.gbl...
我如何申请我正在使用的实际页面名称?这将是
到一个包含文件,根据我在哪个页面,我想做不同的事情。我正在寻找pagename.asp
How do I request the actual page name that I''m on? This is going to go into an include file, and depending on which page I''m on, I''d like to do
different things. I''m looking for "pagename.asp"



middletree,我注意到你的很多问题都得到了解答在 www.aspfaq.com 上的非常简单的文章中。为了节省一些时间,我可能会建议在发布之前在那里搜索。
http://www.aspfaq.com/2072


-

Aaron Bertrand

SQL Server MVP
http://www.aspfaq.com/


" middletree" < MI ******** @ htomail.com>在消息中写道

新闻:#8 ************** @ tk2msftngp13.phx.gbl ...
middletree, I''ve noticed that a lot of your questions are answered in very
straightforward articles at www.aspfaq.com. In order to save yourself some
time, I might suggest searching there before posting here.
http://www.aspfaq.com/2072

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"middletree" <mi********@htomail.com> wrote in message
news:#8**************@tk2msftngp13.phx.gbl...
我如何申请我正在使用的实际页面名称?这将是
到一个包含文件,根据我在哪个页面,我想做不同的事情。我正在寻找pagename.asp
How do I request the actual page name that I''m on? This is going to go into an include file, and depending on which page I''m on, I''d like to do
different things. I''m looking for "pagename.asp"



这篇关于获取页面名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆