现在的位置: 首页 > 综合 > 正文

同样是磁盘配额,但用的是ASP,不过好像简单多了.

2013年09月17日 ⁄ 综合 ⁄ 共 1652字 ⁄ 字号 评论关闭

ASP的:

<%
disk=request.QueryString("disk")
user=request.QueryString("user")
if disk="" or user="" then
Response.Write "没有指定硬盘或用户(disk,user)"
else

Set colDiskQuotas = CreateObject("Microsoft.DiskQuota.1")
colDiskQuotas.Initialize disk, True
set objUser = colDiskQuotas.FindUser(user)
Response.write "警告等级:"
Response.write objUser.QuotaThreshold
Response.write "<p>配额限制:"
Response.write objUser.QuotaLimit
Response.write "<p>使用数量:"
Response.write objUser.QuotaUsed
Response.write "<p>状态:"
Response.write colDiskQuotas.QuotaState

end if
%>

 

ASP.NET的:

<%@ Page language="c#" aspcompat="true" AutoEventWireup="false" %>
<%@ Import Namespace= "DiskQuotaTypeLibrary"%>

<%
 string disk = Request.Params("disk");
 stirng user = Request.Params("user");
 
 if (disk==null || user==null){
  Response.Wirte("没有输入盘或用户名(disk,user).");
  return;
 }

try{
 DiskQuotaControlClass diskQuotaControl = new DiskQuotaControlClass();
 //Initializes the control to the specified path
 diskQuotaControl.Initialize ("f://", true);
 DIDiskQuotaUser dskuser = diskQuotaControl.FindUser("staff");
 Response.Write("磁盘配额:" +dskuser.QuotaLimitText + "<br>");
 Response.Write("警告容量:" + dskuser.QuotaThresholdText + "<br>");
 Response.Write("已用容量:" + dskuser.QuotaUsedText + "<br>");
 Response.Write("状态:" + dskuser.AccountStatus + "<br>");
 Response.Write( "用户名:" + dskuser.LogonName);
}catch{
%>"); Response.Write("警告容量:" + dskuser.QuotaThresholdText + "
"); Response.Write("已用容量:" + dskuser.QuotaUsedText + "
"); Response.Write("状态:" + dskuser.AccountStatus + "
"); Response.Write( "用户名:" + dskuser.LogonName); }catch{ %>"); Response.Write("警告容量:" + dskuser.QuotaThresholdText + "
"); Response.Write("已用容量:" + dskuser.QuotaUsedText + "
"); Response.Write("状态:" + dskuser.AccountStatus + "
"); Response.Write( "用户名:" + dskuser.LogonName); }catch{ %>

【上篇】
【下篇】

抱歉!评论已关闭.