Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I written following code for validate the exiting website binding information. But, I could not get the result. Its validate the IIS express sites only. what can I do for validate the IIS Website programmatically.

my code is
C#
bool bind=true;
using (ServerManager manager = new ServerManager())
{
SiteCollection sites = manager.Sites;
foreach (var IISsite in sites)
{
BindingCollection bindings = IISsite.Bindings;
foreach (Microsoft.Web.Administration.Binding binding in bindings)
{
var oo = IISsite.Bindings
.Where(b => b.EndPoint != null
&& b.EndPoint.Address.ToString() == Bindings
&& b.EndPoint.Port == portNumber)
.FirstOrDefault();
if (oo != null)
return false;
}
}
}
return bind;
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900