I have to block out a certain div for a certain IP addresss
I am using asp here is the code:
<%
Dim sBlockedIP
sBlockedIP = Request.ServerVariables("REMOTE_ADDR")
'check if the IP is the one that is blocked
If sBlockedIP = "00.000.00.00" Then
'if IP address is banned then redirect to no_access.asp
Response.Redirect "no_access.asp"
End If
%>
this is the html that needs to be blocked to this IP
<div id="social_media_outer">
<div id="social_media">
<div id="fb-root"> <script src="#">
</script><fb:like href="" send="true" layout="button_count"
show_faces="false" action="recommend" border="6" font="">
</fb:like>
<span class='st_linkedin' >
</span></span>
<span class='st_facebook' >
</span>
<span class='st_sharethis' st_title="#"></span>
<a href="http://twitter.com/share" data-count="none"><img src="#" style="position:relative;
bottom:-4px; border:none;" /></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><span class="st_email" ></span>
<a href="javascript:print(document)"><img src="http://www.gosh.org/facebook/sharethis/print_icon.gif" style="position:relative;
bottom:-4px; border:none;" /></a>
</div>
</div>
</div>
Can someone help please.
First
Response.Redirectis not the appropriate tool if you only wish to block a part of the generated content (and to block the whole page using IIS IP based security tools would be better than coding it).This would do it
Although you should consider beefing up
CanShowProtectedContentto support a list of bannedIP addresses and/or subnets. Also store the set as an ASP include file.