页面中声明方式定义的用户控件与页面事件的执行顺序
2010-07-31 13:35
295 查看
执行页面的Page_Load事件
执行控件中的Page_Load事件
执行回调事件Button_onclick事件
写ASP程序的朋友都知道,Request.ServerVariables("SCRIPT_NAME") 返回当前页面的相对路径,比如说“http://localhost/bbs/post.asp”,那么返回的就是“bbs/post.asp
文件ip路径:<%="http://" & request.servervariables("server_name")& request.servervariables("script_name") %> <br/>
本机ip:<%=request.servervariables("remote_addr")%> <br/>
服务器名:<%=Request.ServerVariables("SERVER_NAME")%><br/>
服务器IP:<%=Request.ServerVariables("LOCAL_ADDR")%><br/>
服务器端口:<%=Request.ServerVariables("SERVER_PORT")%><br/>
服务器时间:<%=now%><br/>
IIS版本:<%=Request.ServerVariables("SERVER_SOFTWARE")%><br/>
脚本超时时间:<%=Server.ScriptTimeout%><br/>
本文件路径:<%=server.mappath(Request.ServerVariables("SCRIPT_NAME"))%><br/>
服务器CPU数量:<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%><br/>
服务器解译引擎:<%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."&ScriptEngineBuildVersion %><br/>
服务器操作系统:<%=Request.ServerVariables("OS")%> <br/>
支持的文件类型:<%=Request.ServerVariables("HTTP_Accept")%> <br/>
访问的文件路径:<%=Request.ServerVariables("HTTP_url")%> <br/>
用户代理的信息:<%=Request.ServerVariables("HTTP_USER_AGENT")%> <br/>
获取url中的文件名和传过来的值:request.ServerVariables("script_name")+"?"+request.ServerVariableS("QUERY_STRING") <br/>
-----------------------------------------------------------------------------------------------------
产生的如下:
本文件ip路径:http://localhost/ceshi.asp
本机ip:127.0.0.1
服务器名:localhost
服务器IP:127.0.0.1
服务器端口:8091
服务器时间:2005-7-27 14:28:04
IIS版本:Microsoft-IIS/5.0
脚本超时时间:90
本文件路径:E:/hospital/ceshi.asp
服务器CPU数量:2
服务器解译引擎:VBScript/5.6.7426
服务器操作系统:Windows_NT
支持的文件类型:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash,*/*
访问的文件路径:/ceshi.asp
用户代理的信息:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon; COM+ 1.0.2204)
如若获得此文件的目录可以利用下面的函数:
<%
Public Function ServerPath
Dim Path
Dim Pos
Path="http://" & Request.ServerVariables("server_name") & Request.ServerVariables("script_name")
Pos=InStrRev(Path,"/")
ServerPath=Left(Path,Pos)
End Function
%>
=====================<br>
所在文件目录:<%=ServerPath%>
=====================<br>
运行结果为:
所在文件目录:http://localhost/ =====================
类别:常用环境变量 |
![](https://oscdn.geek-share.com/Uploads/Images/Content/201007/2d63c25235cd0987497539fcc378b1f4.gif)
| 添加到搜藏 | 分享到i贴吧 | 浏览(597) | 评论 (0)
执行控件中的Page_Load事件
执行回调事件Button_onclick事件
写ASP程序的朋友都知道,Request.ServerVariables("SCRIPT_NAME") 返回当前页面的相对路径,比如说“http://localhost/bbs/post.asp”,那么返回的就是“bbs/post.asp
request.servervariables("script_name") 功能是判断并输出当前执行文件的路径及文件名称。 当你变更了asp文件的名称的时候,系统会自动适应,方便系统的移植。 如果是指定提交页面,一旦文件名称变了,系统就会出错。 |
本机ip:<%=request.servervariables("remote_addr")%> <br/>
服务器名:<%=Request.ServerVariables("SERVER_NAME")%><br/>
服务器IP:<%=Request.ServerVariables("LOCAL_ADDR")%><br/>
服务器端口:<%=Request.ServerVariables("SERVER_PORT")%><br/>
服务器时间:<%=now%><br/>
IIS版本:<%=Request.ServerVariables("SERVER_SOFTWARE")%><br/>
脚本超时时间:<%=Server.ScriptTimeout%><br/>
本文件路径:<%=server.mappath(Request.ServerVariables("SCRIPT_NAME"))%><br/>
服务器CPU数量:<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%><br/>
服务器解译引擎:<%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."&ScriptEngineBuildVersion %><br/>
服务器操作系统:<%=Request.ServerVariables("OS")%> <br/>
支持的文件类型:<%=Request.ServerVariables("HTTP_Accept")%> <br/>
访问的文件路径:<%=Request.ServerVariables("HTTP_url")%> <br/>
用户代理的信息:<%=Request.ServerVariables("HTTP_USER_AGENT")%> <br/>
获取url中的文件名和传过来的值:request.ServerVariables("script_name")+"?"+request.ServerVariableS("QUERY_STRING") <br/>
-----------------------------------------------------------------------------------------------------
产生的如下:
本文件ip路径:http://localhost/ceshi.asp
本机ip:127.0.0.1
服务器名:localhost
服务器IP:127.0.0.1
服务器端口:8091
服务器时间:2005-7-27 14:28:04
IIS版本:Microsoft-IIS/5.0
脚本超时时间:90
本文件路径:E:/hospital/ceshi.asp
服务器CPU数量:2
服务器解译引擎:VBScript/5.6.7426
服务器操作系统:Windows_NT
支持的文件类型:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash,*/*
访问的文件路径:/ceshi.asp
用户代理的信息:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon; COM+ 1.0.2204)
如若获得此文件的目录可以利用下面的函数:
<%
Public Function ServerPath
Dim Path
Dim Pos
Path="http://" & Request.ServerVariables("server_name") & Request.ServerVariables("script_name")
Pos=InStrRev(Path,"/")
ServerPath=Left(Path,Pos)
End Function
%>
=====================<br>
所在文件目录:<%=ServerPath%>
=====================<br>
运行结果为:
所在文件目录:http://localhost/ =====================
类别:常用环境变量 |
![](https://oscdn.geek-share.com/Uploads/Images/Content/201007/2d63c25235cd0987497539fcc378b1f4.gif)
| 添加到搜藏 | 分享到i贴吧 | 浏览(597) | 评论 (0)
![]() | 登录后,您就出现在这里。 | ![]() | ![]() | ![]() |
相关文章推荐
- ASP.Net 母版、页面、用户控件事件的执行顺序
- ASP.NET中页面及用户控件的事件执行顺序
- ASP.NET中页面及用户控件的事件执行顺序
- ASP.NET页面事件过程-多个用户控件时的执行过程
- .net用户控件和页面的加载事件顺序
- asp.net页面装载用户控件时的事件顺序
- 页面装载用户控件时的事件顺序
- 应用程序按照以下顺序执行由 global.asax 文件中定义的模块或用户代码处理的事件
- 页面和页面里的控件的事件的执行顺序。
- 页面,master页面,用户控件的执行顺序
- 用户控件与页面执行顺序
- 页面装载用户控件时的事件顺序
- 页面(Page)加载用户控件(UserControl)的事件触发顺序
- 页面装载用户控件时的事件顺序
- ASP.NET页面上直接放置用户控件WebUserControl1时的事件顺序
- saucer(思归)解决的关于:页面A.aspx 动态载入用户自定义控件a.ascx,但a.ascx中的按钮提交后,不执行按钮的事件,而是直接刷新页面
- 页面和页面里的控件的事件的执行顺序。
- 页面(Page)加载用户控件(UserControl)的事件触发顺序
- 页面和页面里的控件的事件的执行顺序。
- 页面装载用户控件时的事件顺序 (转)