Reading IIS 7.0 metabase

Posted by Suman Pulaparthi under ASP.NET on 10/8/2009 | Views : 1823 | Status : [Member] | Replies : 2
In the iis server the development team has an added a custom handler for .mvc extension.

in windows application how could i check whether .mvc handler is added or not.I want to enumerate all the http handler using c#.

Thanks in advance




Responses

Posted by: Vuyiswamb on: 10/9/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Am not Sure if this Can help

http://www.codeproject.com/KB/web-image/thumbnailer.aspx


http://www.hanselman.com/blog/NotQuiteEnumeratingIteratingEnums.aspx


http://www.codeguru.com/csharp/csharp/cs_network/http/article.php/c11013/

Thank you for posting at dotnetfunda

Vuyiswa Maseko


Thank you for posting at Dotnetfunda
[Administrator]

Suman Pulaparthi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Tridev_2005 on: 10/12/2009 [Member] Starter

Up
0
Down
You can use Microsoft.Web.Administration for that, however be aware that if you really want to read the entire list of sites (not only the ones running in the current application pool) the request needs to be running as someone that has administrative privileges since ApplicationHost.config file is only read-able by Administrators.

Try doing something like:

Microsoft.Web.Administration.ConfigurationSection sitesSection = Microsoft.Web.Administration.WebConfigurationManager.GetSection("system.applicationHost/sites");

foreach(ConfigurationElement e in sitesSection.GetCollection()) {

Response.Write((string)e["name"]);

}


This will work even if the request is running as "non-administrator"

Suman Pulaparthi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response