Gaurav Taneja

Great dreams... never even get out of the box. It takes an uncommon amount of guts to put your dreams on the line, to hold them up and say, "How good or how bad am I?" That's where courage comes in.

  Home  |   Contact  |   Syndication    |   Login
  90 Posts | 0 Stories | 78 Comments | 7 Trackbacks

News




Google RankGoogle PR™ - Post your Page Rank with MyGooglePageRank.com



The content on this site represents my own personal opinions and thoughts at the time of posting, and does not reflect those of my employer's in any way.

Disclaimer:- All postings in this blog is provided "AS IS" with no warranties, and confers no rights.

Archives

Post Categories

Image Galleries

Atlas

Error

OutLook

SharePointService

Usefull Site Links

using

System;

using

System.Collections.Specialized;

using

System.ComponentModel;

using

System.Data;

using

System.Drawing;

using

System.Web;

using

System.Web.SessionState;

using

System.Web.UI;

using

System.Web.UI.WebControls;

using

System.Web.UI.HtmlControls;

using

System.DirectoryServices;

 

namespace

SearchIIS

{

 

/// <summary>

 

/// Summary description for iissearch.

 

/// </summary>

 

public class iissearch : System.Web.UI.Page

{

 

protected System.Web.UI.WebControls.ListBox lst_iisdir;

 

 

private void Page_Load(object sender, System.EventArgs e)

{

 

// Put user code to initialize the page here

 

if (!Page.IsPostBack)

{

GetIISVirtualDirectories();

 

}

 

}

#region

Web Form Designer generated code

 

override protected void OnInit(EventArgs e)

{

 

//

 

// CODEGEN: This call is required by the ASP.NET Web Form Designer.

 

//

InitializeComponent();

 

base.OnInit(e);

}

 

 

/// <summary>

 

/// Required method for Designer support - do not modify

 

/// the contents of this method with the code editor.

 

/// </summary>

 

private void InitializeComponent()

{

 

this.Load += new System.EventHandler(this.Page_Load);

}

#endregion

 

public void GetIISVirtualDirectories()

{

 

string provider = "IIS://192.168.2.250/W3SVC/1/Root"; // Add your Ip Address

DirectoryEntries dirEntries =

null;

DirectoryEntry dirEntry =

null;

 

try

{

dirEntry =

new DirectoryEntry(provider);

dirEntry.RefreshCache();

dirEntries = dirEntry.Children;

 

foreach(DirectoryEntry objDir in dirEntries)

{

Response.Write("IIS Virtual Directories: " + (objDir.Name.ToString()) + "<br>");

}

dirEntry.Dispose();

 

}

catch(Exception Ex)

{

Response.Write(Ex.Message);

}

}

}

}

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted on Tuesday, April 03, 2007 12:00 PM