11 Replies - 1912 Views - Last Post: 27 June 2014 - 07:15 AM Rate Topic: -----

#1 closser  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 12-January 12

Deny IP RANGE access to a directory in IIS 6.0?

Posted 01 June 2014 - 03:53 AM

Hello, the title says it all.

How can I deny access to a directory in IIS 6.0 *public website* ( or how do i name it) through a file ( like the htaccess for linux/apache ).

If i wasn't clear, let me show you an example of my question, how do i convert this **.htaccess** into IIS (6.0) and save/use it as A FILE, if it's possible:

deny from 11.22.0.0/19
deny from 44.55.0.0/19


Thank you.

Is This A Good Question/Topic? 0
  • +

Replies To: Deny IP RANGE access to a directory in IIS 6.0?

#2 closser  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 12-January 12

Re: Deny IP RANGE access to a directory in IIS 6.0?

Posted 01 June 2014 - 10:50 AM

Helo, ANY ANSWER?
Was This Post Helpful? 0
  • +
  • -

#3 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,511
  • Joined: 16-March 11

Re: Deny IP RANGE access to a directory in IIS 6.0?

Posted 01 June 2014 - 01:12 PM

you want to block an IP range from accessing the site? Or just a part of your site? You need to be more specific. Also what have you tried exactly? You have access to the IP of the user, so why can't you take advantage of that?
Was This Post Helpful? 0
  • +
  • -

#4 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5937
  • View blog
  • Posts: 12,862
  • Joined: 16-October 07

Re: Deny IP RANGE access to a directory in IIS 6.0?

Posted 02 June 2014 - 04:15 AM

What, exactly, did you do to try to find an answer?

I don't usually do this... but, seriously, Google is your friend: http://www.google.co...ess+restriction

Third hit seems applicable to IIS 6 and up.
http://www.iis.net/c...rity/ipsecurity

This post has been edited by baavgai: 02 June 2014 - 04:16 AM

Was This Post Helpful? 0
  • +
  • -

#5 closser  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 12-January 12

Re: Deny IP RANGE access to a directory in IIS 6.0?

Posted 02 June 2014 - 05:37 AM

View Posttrevster344, on 01 June 2014 - 01:12 PM, said:

you want to block an IP range from accessing the site? Or just a part of your site? You need to be more specific. Also what have you tried exactly? You have access to the IP of the user, so why can't you take advantage of that?


Thansk for the reply, I want to block just a part of my site, for a specific ip range.

View Postbaavgai, on 02 June 2014 - 04:15 AM, said:

What, exactly, did you do to try to find an answer?

I don't usually do this... but, seriously, Google is your friend: http://www.google.co...ess+restriction

Third hit seems applicable to IIS 6 and up.
http://www.iis.net/c...rity/ipsecurity


Thanks for the reply, and i've seen it and google it, but it didn't work.

I've created a web.config file with the following code on the directory i want to block from this ip range and tested it but it won't work.
eg.
<configuration>
    <location path=”test/test/” >
        <system.web>
<security>
   <ipSecurity allowUnlisted="true">    <!-- this line allows everybody, except those listed below -->            
       <clear/>     <!-- removes all upstream restrictions -->                
       <add ipAddress="12.34.56.78"/>     <!-- blocks the specific IP   -->                       
   </ipSecurity>
</security>
        </system.web>
    </location>
</configuration>

Was This Post Helpful? 0
  • +
  • -

#6 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,511
  • Joined: 16-March 11

Re: Deny IP RANGE access to a directory in IIS 6.0?

Posted 02 June 2014 - 08:01 AM

Is it your IP you're trying to give exclusivity of the page too?
Was This Post Helpful? 0
  • +
  • -

#7 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5937
  • View blog
  • Posts: 12,862
  • Joined: 16-October 07

Re: Deny IP RANGE access to a directory in IIS 6.0?

Posted 02 June 2014 - 08:51 AM

Make sure the IP address of the client is what you think it is. For testing, you can show it somewhere on a web page. However, you'll also want to find it in the logs.

Also, if there is a web.config a level higher with allowUnlisted false, your config will fail.
Was This Post Helpful? 0
  • +
  • -

#8 closser  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 12-January 12

Re: Deny IP RANGE access to a directory in IIS 6.0?

Posted 03 June 2014 - 07:02 AM

View Posttrevster344, on 02 June 2014 - 08:01 AM, said:

Is it your IP you're trying to give exclusivity of the page too?

No, All ip's, except a few ranges i would block.

View Postbaavgai, on 02 June 2014 - 08:51 AM, said:

Make sure the IP address of the client is what you think it is. For testing, you can show it somewhere on a web page. However, you'll also want to find it in the logs.

Also, if there is a web.config a level higher with allowUnlisted false, your config will fail.

btw, i dont have any access on the windows, i just want a restrict through a web.config file or whatever it is, and i removed all other web.config's but it still won't work any idea?
Was This Post Helpful? 0
  • +
  • -

#9 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9579
  • View blog
  • Posts: 36,293
  • Joined: 12-June 08

Re: Deny IP RANGE access to a directory in IIS 6.0?

Posted 03 June 2014 - 07:38 AM

The other option would be to do it programatically. In, say, the page load event... have the page reach out to a 'banned ip' db and see if the incoming ip matches something in the table.. if so redirect to another page.
Was This Post Helpful? 0
  • +
  • -

#10 closser  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 12-January 12

Re: Deny IP RANGE access to a directory in IIS 6.0?

Posted 03 June 2014 - 02:52 PM

View Postmodi123_1, on 03 June 2014 - 07:38 AM, said:

The other option would be to do it programatically. In, say, the page load event... have the page reach out to a 'banned ip' db and see if the incoming ip matches something in the table.. if so redirect to another page.

Hi thanks for the reply, idk what you exactly meant but i believe there's a way through a file similar to .htaccess for windows that could do it... web.config or whatever it is thats what im asking for.
Was This Post Helpful? 0
  • +
  • -

#11 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,511
  • Joined: 16-March 11

Re: Deny IP RANGE access to a directory in IIS 6.0?

Posted 03 June 2014 - 09:12 PM


Public ProgrammerIP as String = "xxx.xxx.xxx.xxx"

'PAGE LOAD EVENT'

If <> Request.UserHostAddress = ProgrammerIP Then 

Response.Clear()
Response.Write("<div align='center'>Access Denied.</div>")
Response.End()

End If




This is the code, more or less, that I've used a few times.
Was This Post Helpful? 0
  • +
  • -

#12 closser  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 12-January 12

Re: Deny IP RANGE access to a directory in IIS 6.0?

Posted 27 June 2014 - 07:15 AM

View Posttrevster344, on 03 June 2014 - 09:12 PM, said:


Public ProgrammerIP as String = "xxx.xxx.xxx.xxx"

'PAGE LOAD EVENT'

If <> Request.UserHostAddress = ProgrammerIP Then 

Response.Clear()
Response.Write("<div align='center'>Access Denied.</div>")
Response.End()

End If




This is the code, more or less, that I've used a few times.


how do i name the file? where do i put that?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1