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{
%>