IIS API - Block IP
am 24.09.2007 14:32:00 von dantheriver
I have a web app that logs the IP's of users that appear to be hacking the
site. Right now I manually look at the recoreded IP's and enter them into IIS
as IP's to block for all websites. I would like to do this progmatically with
the IIS API. Can anyone point me to the right Objects/Methods, or even some
sample code on how to do this?
Any help is much appreciated.
Re: IIS API - Block IP
am 24.09.2007 17:22:21 von Kristofer Gafvert
Hi Dan,
The following example uses C# and ADSI (don't be fooled by the link, it is
ADSI, not WMI :-)
http://www.codeproject.com/csharp/iiswmi.asp
The metabase property you want to change is IPSecurity:
http://www.microsoft.com.nsatc.net/technet/prodtechnol/Windo wsServer2003/Library/IIS/fd6980cc-7b3f-4b5f-a9a0-2da7edc51ed a.mspx?mfr=true
Or use a method exposed by the IIsIPSecurity ADSI object:
http://msdn2.microsoft.com/en-us/library/ms524685.aspx
Hope this helps.
--
Regards,
Kristofer Gafvert
http://www.gafvert.info/iis/ - IIS Related Info
Dan wrote:
>I have a web app that logs the IP's of users that appear to be hacking the
>site. Right now I manually look at the recoreded IP's and enter them into
>IIS
>as IP's to block for all websites. I would like to do this progmatically
>with
>the IIS API. Can anyone point me to the right Objects/Methods, or even some
>sample code on how to do this?
>
>Any help is much appreciated.
Re: IIS API - Block IP
am 24.09.2007 17:38:06 von dantheriver
Perfect! Thanks so much.
"Kristofer Gafvert" wrote:
> Hi Dan,
>
> The following example uses C# and ADSI (don't be fooled by the link, it is
> ADSI, not WMI :-)
>
> http://www.codeproject.com/csharp/iiswmi.asp
>
> The metabase property you want to change is IPSecurity:
>
> http://www.microsoft.com.nsatc.net/technet/prodtechnol/Windo wsServer2003/Library/IIS/fd6980cc-7b3f-4b5f-a9a0-2da7edc51ed a.mspx?mfr=true
>
> Or use a method exposed by the IIsIPSecurity ADSI object:
>
> http://msdn2.microsoft.com/en-us/library/ms524685.aspx
>
> Hope this helps.
>
> --
> Regards,
> Kristofer Gafvert
> http://www.gafvert.info/iis/ - IIS Related Info
>
>
> Dan wrote:
>
> >I have a web app that logs the IP's of users that appear to be hacking the
> >site. Right now I manually look at the recoreded IP's and enter them into
> >IIS
> >as IP's to block for all websites. I would like to do this progmatically
> >with
> >the IIS API. Can anyone point me to the right Objects/Methods, or even some
> >sample code on how to do this?
> >
> >Any help is much appreciated.
>
Re: IIS API - Block IP
am 26.09.2007 15:21:32 von wjzhang
Hi Dan,
Just a little supplement, Metabase Explorer will be a very helpful utility
for you to check IIS metabase change when debugging the code. It's included
in IIS6 reskit tools.
Internet Information Services (IIS) 6.0 Resource Kit Tools
http://www.microsoft.com/downloads/details.aspx?displaylang= en&familyid=56fc
92ee-a71a-4c73-b628-ade629c89499
If you meet any problem in the coding process, please don't hesitate to
update in the newsgroup. It's always our pleasure to be of assistance.
Have a great day.
Sincerely,
WenJun Zhang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at:
http://msdn.microsoft.com/subscriptions/support/default.aspx .
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.