Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to remove the site binding from IIS Programmatically.
Public Sub RemoveServerBinding(hostname As String, sitename As String)


	Dim serverMgr As New ServerManager()

	Dim mySite As Site = serverMgr.Sites(sitename)

	For i As Integer = 0 To mySite.Bindings.Count - 1


		If mySite.Bindings(i).Host = hostname Then


			mySite.Bindings.RemoveAt(i)


			Exit For

		End If
	Next

	mySite.ServerAutoStart = True

End Sub


I am using the above code but its not working for me. Its not giving any error but its not removing IIS Binding.
Below is the url from where I got the reference code
http://www.c-sharpcorner.com/Blogs/12118/working-with-iis-7-programmetically-using-C-Sharp.aspx[^]

Can any one please help me out asap. Thanks
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