CSDN博客

img keenx

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

发表于2004/6/22 21:13:00  857人阅读

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" %><%@ 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{
%><%@ 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 + "
"); Response.Write("警告容量:" + dskuser.QuotaThresholdText + "
"); Response.Write("已用容量:" + dskuser.QuotaUsedText + "
"); Response.Write("状态:" + dskuser.AccountStatus + "
"); Response.Write( "用户名:" + dskuser.LogonName); }catch{ %><%@ 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 + "
"); Response.Write("警告容量:" + dskuser.QuotaThresholdText + "
"); Response.Write("已用容量:" + dskuser.QuotaUsedText + "
"); Response.Write("状态:" + dskuser.AccountStatus + "
"); Response.Write( "用户名:" + dskuser.LogonName); }catch{ %>

0 0

相关博文

我的热门文章

img
取 消
img