欢迎光临极品网,更多、更新的资源信息尽在Jpinw.Com!本站所有信息资源每日更新新的内容,请大家继续关注www.Jpinw.com!如果觉得本站还不错,对您有帮助,别忘了向您的朋友推荐本站!请记好本站网址:http://www.Jpinw.com,网站发展靠大家多多的支持!!!

极品网 极品课件 极品论文 极品文学 极品游戏 极品美容 极品手机资源 极品股票

#
免费资源: 免费域名 | 免费空间 | 免费推广 | 免费邮箱 | 免费硬盘 | 免费论坛 | 免费留言 | 免费统计 | 在线投稿 | 更多...
电脑学院: 操作系统 | 安全相关 | 网页设计 | 编程开发 | 建站经验 | 服务器类 | 黑客攻防 | 菜鸟入门 | 教你网赚 | 更多...
文章导航: 网赚学堂 | 网赚秘笈 | 网赚三维 | 网赚先锋 | 网赚资讯 | 感悟网赚 | 众生百态 | 经典美文 | 范文中心 | 更多...
图酷天下: 时事图酷 | 娱乐图酷 | 搞笑图酷 | 时尚图酷 | 体育图酷 | 另类经典 | 论文资源 | 课件下载 | 文学知识 | 更多...

您现在的位置: 极品网 >> 电脑学院 >> 编程开发 >> 编程综合 >> 教程正文

Asp.net实现IIS控制管理(Web虚拟目录的创建及管理)            【字体:
Asp.net实现IIS控制管理(Web虚拟目录的创建及管理)
作者:佚名    教程来源:不详    点击数:    更新时间:2008-1-1    

 








Asp.net实现IIS控制管理(Web虚拟目录的创建及管理)。


(一)CreateWebDir.cs 使用示例

      string sServer = "localhost";
      string VirtualDir = "Bug2004";                   \\虚拟目录
      string PathDir    = @"D:\myWebDirTest\Bug2000"   \\物理目录

   IISManager iisMg = new IISManager(sServer);
   iisMg.Connect();
   
   if (iisMg.Exists(VirtualDir]))
   {
    Console.Write(VirtualDir+ " is exist!");
   }
   else
   {
    myINI.IniWriteValue("WebDir","WebDirExist","false");

    iisMg.get_AnonymousUser();
    string[] anonymousUser = new string[2];
    anonymousUser[0] = iisMg.AnonymousUserName ;
    anonymousUser[1] = iisMg.AnonymousUserPass ;

    VirtualDirectory newVirDir = new VirtualDirectory(VirtualDir,PathDir,anonymousUser);
    if (iisMg.Create(newVirDir))
     Console.Write(VirtualDir+ " 创建成功!");
    else
     Console.Write(VirtualDir+ " 创建不成功!");
   }

   iisMg.Close();

(二)CreateWebDir.cs 是转贴过来的,我作了些完善和修改

///***********************************************************
///**************                IIS控制管理类                **************
///************** 转贴自: 飞刀 http://www.aspcn.com *************
///***********************************************************
using System;
using System.Data;
using System.DirectoryServices;
using System.Collections;

namespace CreateWebDir
{
/// <summary>
/// IISManager 的摘要说明。
/// </summary>
public class IISManager
{
  //定义需要使用的
  private string _server,_website,_AnonymousUserPass,_AnonymousUserName;
  private VirtualDirectories _virdirs;
  protected System.DirectoryServices.DirectoryEntry rootfolder;
  private bool _batchflag;
  public IISManager()
  {
   //默认情况下使用localhost,即访问本地机
   _server = "localhost";
   _website = "1";
   _batchflag = false;
  }
  public IISManager(string strServer)
  {
   _server = strServer;
   _website = "1";
   _batchflag = false;
  }
  /// <summary>
  /// 定义公共属性
  /// </summary>

  public void get_AnonymousUser()
  {
   _AnonymousUserPass="IUSR_DEVE-SERVER";
   _AnonymousUserName="IUSR_DEVE-SERVER";
   VirtualDirectory vDir;
   try
   {
    Hashtable myList = (Hashtable)_virdirs;
    IDictionaryEnumerator myEnumerator = myList.GetEnumerator();

[1] [2] [3] [4] [5] [6] 下一篇

 

教程录入:admin    责任编辑:admin 
  • 上一篇教程:

  • 下一篇教程:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关教程
    [我的ASP.net学习历程]有关于
    《Asp.Net Forums2.0深入分析
    ASP.NET 2.0页面性能的考虑
    ASP.NET 2.0打造购物车和支付
    关于ASP.Net中的时间处理
    基于asp.net的web页面动态控
    ASP.NET ViewState 初探 (3)
    ASP.NET/Perl.NET 数据库访问
    ASP.NET: Connection String
    ASP.NET: HtmlEncode/UrlEnc
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    极品网
    | 设为首页 | 加入收藏 | 友情链接 | 版权声明 |
    极品网

    Copyright 2006 Jpinw.com 极品网

    备案号:浙ICP备07010375号

    极品网