导航:首页 > IDC知识 > asp获取服务器系统

asp获取服务器系统

发布时间:2020-12-24 17:38:28

1、ASP如何获取SQL服务器上的当前时间

你把那个字段的默认值设为 getdate() 就好了,新增记录,那个字段就会自动取当前时间了...

2、ASP、jS获取服务器时间和自己电脑系统时间

dt类的都有获取当前时间的函数。getInstance(java)和currenttime(asp)就是。
但这两个都是获取当前电脑时间,即你的程序在哪里运行就是获取哪个时间。

从你的提问看你是想在客户端运行程序并获取自己电脑时间和服务器时间。如果这样的话:
1、获取自己电脑系统时间,就可以用上面两个函数实现,具体看你用什么工具编程。
2、服务器时间,建议在服务器上建立一个服务,同样用上面两个函数可以得到服务器的时间,问题的关键是这个服务要把你获取的服务器时间暴露出来,可以通过服务函数解决。

3、如何用ASP获取浏览器的名称,版本号及服务器的端口号

操作系统:
<%=Request.ServerVariables("OS")%>
服务器名称:
<%=Request.ServerVariables("SERVER_NAME")%>

服务器IP:
<%=Request.ServerVariables("LOCAL_ADDR")%>
CPU数量:
<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%>个

服务端口:
<%=Request.ServerVariables("SERVER_PORT")%>
Webserver及版本:
<%=Request.ServerVariables("SERVER_SOFTWARE")%>

脚本解释引擎:
<%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %>
服务协议及版本:
<%=Request.ServerVariables("SERVER_PROTOCOL")%>

脚本超时时间:
<%=Server.ScriptTimeout%>秒
网站物理路径:
<%=request.ServerVariables("APPL_PHYSICAL_PATH")%>

<%
Dim BrowseMsg,BrowseVersion,SystemVersion
BrowseMsg=Request.ServerVariables("HTTP_USER_AGENT")
'+++++++++++一个基本判别操作系统的函数+++++++++++
Function SystemCheck()
if inStr(BrowseMsg,"Windows 98") then
SystemCheck="Windows 98"
else if inStr(BrowseMsg,"Windows NT 4.0") then
SystemCheck="Windows NT 4.0"
else if inStr(BrowseMsg,"Windows NT 5.0") then
SystemCheck="Windows NT 2000"
else
SystemCheck="未知类型"
end if
end if
end if
end Function
'由于时间的原因我没有写判定win95和windows xp的语句,感兴趣的网友可以
'自行添加:)
'+++++++++++结束+++++++++++
if inStr(BrowseMsg,"MSIE") then
SystemVersion=CInt(Mid(BrowseMsg,inStr(BrowseMsg,"MSIE")+5,1))
response.write "您的浏览器的版本是 IE"&BrowseVersion&"<BR>"
response.write "您的操作系统是 "&SystemCheck()
end if
%>

4、ASP获取服务器及本地信息 代码如何编写

<html>
<head>
<link href="../css.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="50%" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#336699">
<tr bgcolor="" align="center">
<td height="20" colspan="2" class="htd" ><font color="#FFFFFF"><b>服 务 器 的 配 置</b></font></td>
</tr>
<tr>
<td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">检取ISAPIDLL的metabase路径</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("APPL_MD_PATH")%></font></td>
</tr>
<tr>
<td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">路径信息</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("PATH_INFO")%></font></td>
</tr>
<tr>
<td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">服务器IP地址</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("LOCAL_ADDR")%></font></td>
</tr>
<tr>
<td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">显示执行SCRIPT的虚拟路径</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("SCRIPT_NAME")%></font></td>
</tr>
<tr>
<td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">返回服务器的主机名,DNS别名,或IP地址</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("SERVER_NAME")%></font></td>
</tr>
<tr>
<td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">返回服务器处理请求的端口</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("SERVER_PORT")%></font></td>
</tr>
<tr>
<td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">协议的名称和版本</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("SERVER_PROTOCOL")%></font></td>
</tr>
<tr>
<td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">服务器的名称和版本</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("SERVER_SOFTWARE")%></font></td>
</tr>
<tr>
<td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">服务器操作系统内核</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("OS")%></font></td>
</tr>
<tr>
<td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">脚本超时时间</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Server.ScriptTimeout%> 秒</font></td>
</tr>
<tr>
<td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">服务器CPU数量</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%> 个</font></td>
</tr>
<tr>
<td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">服务器解译引擎</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %></font></td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td height="20" colspan="2" align="center">

</td>
</tr>
<tr>
<td height="20" colspan="2" class="htd" align="center" bgcolor="#336699">
<font color="#FFFFFF"><b>浏 览 器 信 息</b></font>
</td>
</tr>
<tr>
<td height="20" colspan="2" align="center" bgcolor="#336699">
<%set browscap=server.createobject("mswc.browsertype")%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">浏览器类型</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.browser%></font></td></tr>
<tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">浏览器版本</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.version%></font></td></tr>
<tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持表格</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.tables%></font></td></tr>
<tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持ActiveX控件</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.activexcontrols%></font></td></tr>
<tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持JavaApplets</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.javaapplets%></font></td></tr>
<tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持Javascript</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.javascript%></font></td></tr>
<tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持Cookies</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.cookies%></font></td></tr>
<tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持框架</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.frames%></font></td></tr>
<tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持VBScript</font></td>
<td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.vbscript%></font></td></tr>
</table>
<%set browscap=nothing%>
</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td height="20" colspan="2" align="center">

</td>
</tr>
<tr>
<td height="20" colspan="2" class="htd" align="center" bgcolor="#336699">
<font color="#FFFFFF"><b>磁 盘 驱 动 器 信 息</b></font>
</td>
</tr>
<tr>
<td height="20" colspan="2" >
<%
function tran(driver)
select case driver
case 0:tran="设备无法识别"
case 1:tran="软盘驱动器"
case 2:tran="硬盘驱动器"
case 3:tran="网络硬盘驱动器"
case 4:tran="光盘驱动器"
case 5:tran="RAM虚拟磁盘"
end select
end function
set fso=server.createobject("scripting.filesystemobject")
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#336699">
<tr><td class="htd" align="center"><font color="#FFFFFF">盘符</font></td><td class="htd" align="center"><font color="#FFFFFF">类型</font></td><td class="htd" align="center"><font color="#FFFFFF">卷标</font></td>
<td class="htd" align="center"><font color="#FFFFFF" >总计大小</font></td><td class="htd" align="center"><font color="#FFFFFF">可用空间</font></td><td class="htd" align="center"><font color="#FFFFFF">文件系统</font></td>
<td class="htd" align="center"><font color="#FFFFFF">序列号</font></td><td class="htd" align="center"><font color="#FFFFFF">是否可用</font></td><td class="htd" align="center"><font color="#FFFFFF">路径</font></td>
</tr>
<%
for each drv in fso.drives
response.write"<tr>"
response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & drv.driveletter &"</font></td>"
response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & tran(drv.drivetype) &"</font></td>"
response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & drv.volumename &"</font></td>"
response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & formatnumber(drv.totalsize/1024,0) &"</font></td>"
response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & formatnumber(drv.availablespace/1024,0) &"</font></td>"
response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & drv.filesystem &"</font></td>"
response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & drv.serialnumber &"</font></td>"
response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & drv.isready &"</font></td>"
response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & drv.path &"</font></td>"
next
%>
</table>
</td>
</tr>
</table>

</td>
</tr>
</table>
</body>
</html>

5、asp获取服务器时间

方法很多,大致有:

1、获取客户端时间,与当前服务器时间,进行比较,若时间存在过大差值,回则停止后续服务答与代码
2、全部改用服务器时间,这样代码修改量估计不小,还容易存在BUG
3、核心业务处加上时间校验,其他的无所谓吧
由于看不到源代码,只能帮到这个地步了

6、asp服务器端如何获取文本框的值

把文本框放在表单里,给文本框取名比如“aaa”

获取值的页面在代码里写:
<%
a=request("aaa")'获取前面提交过来aaa的值
response.write(a)'打印aaa的值
%>

Request对象探讨

Request是ASP里的一个内部对象,用于获取HTTP请求中传递的任意信息(如头信息、表单数据、cookies等等)。所以这是在ASP里面最常用的内部对象,常用来获得GET方式提交的数据(Request.QueryString)、表单POST提交的数据(Request. Form)和Cookies(Request.Cookies)。

我们用Request对象可以指定获取某个特定方式提交的数据。比如我们用这段代码获得通过POST提交的数据lake2的值:request.Form("lake2");而request.queryString("CSDN")获得GET方式提交的CSDN的值。

对于获取HTTP数据,ASP还给了我们一个更简单的方法:request(key),即直接使用request而不指定数据集合。此时ASP会依次在QueryString、From、Cookies、ServerVariables、ClientCertificate、Browser中检查匹配的数据,若发现则返回数据。

上面6个集合中,ServerVariables、ClientCertificate和Browser的变量是固定了的;而QueryString、From、Cookies的变量可以任意指定。想不到Cookies可以拿来传递任意数据,以前倒没有注意。

OK,test一下先。在本地web目录新建test.asp文件,内容为:<%=request("b")%>

Step 1:直接访问http://127.0.0.1/test.asp?b=la<b>k</b>e2,浏览器显示lake2

Step 2:构造表单提交结果也如step 1

Step 3: 构造表单,GET传递b值为"He",同时POST的b为"She",浏览器显示为"He"。呵呵,按前面的排序有个优先级的

Step 4:Telnet到本地80端口,构造HTTP请求如下(注意Cookies哦):

GET /test.asp HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; TencentTraveler ; .NET CLR 1.1.4322)
Host: 127.0.0.1
Connection: Keep-Alive
Cookie: b=lake2 , Success !
在一堆服务器响应数据之后,我们看到了"lake2,Success!"(Q:为什么空格不见了?A:因为未对提交的空格进行URL编码)。

到此,我们已理论和实际相结合的证明了Cookies可以拿来传递数据。

7、asp 获取服务器字体

一般不用这样做.实现的可能性也不大.

放法是用FSO来读取winnt/font目录下的文件.
再人工看一内下里面安装了什么字容体,再在程序里使用已安装的字体.
只是前体条件是你的服务器支持FSO,并且你有足够的权限.

一般做法是使用常见字体,如果你实现想用特别字体就跟服务器空间提供商商量一下,应该也可以.

其实一般服务器其本上都不会装什么字体,都是系统默认的一些字体.你用这些就好了,如:
黑体,宋体,访宋体,楷体,隶书

8、ASP服务器IP地址获取

老兄这不是来重复,你前面那个127.0.0.1其实自就是localhost,可能你电脑设置了什么吧,通常情况下是这样显示的http://localhost/127.0.0.1

后面那个才是你用代码获取的。

9、asp如何获得服务器所在的时区?

根据我的经验哈,你的服务器通常只有一个,不可能今天是这个时区,明天是那个时区,直接显示当前时间,然后和北京时间比,差多少时间,后面在计算的时候补上。

凡是需要放到国外的程序,都应该增加一个时间调节常量。放在国内设为0,放到美国西部设为+16.凡是遇到时间的地方都增加一下时间调节常量。

10、asp 获取服务器端操作系统信息

服务器操作系统:<%=Request.ServerVariables("OS")%>
服务器的名称和版本:<%=Request.ServerVariables("SERVER_SOFTWARE")%>
是这个

与asp获取服务器系统相关的知识