An observation: Door Store -vs- Vote-For-Me yard signs

Traditional email spam like the unsolicited Door Store ads they drop on my step (in plastic covers to maximize slipping).

Comment spam is a “We’re voting for Mr. Shmiggle” sign put in my yard without my consent.

Now that I’ve worked it out, I understand why comment spam irks me so much more, because it (ab)uses my reputation for its own (search engine) advancement.  But I don’t want to put up a fence by closing comments tho, because I do want my friendly neighbors to visit and talk to me.

So anyway, if anyone using .Text 0.95 is interested, here’s my code to negate the search engine benefit to the comment spammers:

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
	Dim reqURL As String = Request.CurrentExecutionFilePath
	IF reqURL.toLower().indexOf("/archive/")<0 OR Request.Form.ToString()<>"" THEN EXIT SUB
	
	'-- get content
	Dim oWriter As New StringWriter()
	Server.Execute(reqURL, oWriter)
	Dim strResponse As String = oWriter.ToString()
	oWriter = Nothing

	'-- find comment section
	Dim iStart As Integer, iStop As Integer
	iStart = strResponse.IndexOf("<div id=""comments"">")
	IF iStart>0 THEN iStop = strResponse.IndexOf("</div>", iStart)

	If iStart <> -1 And iStop <> -1 Then
		'-- nofollow comment section's links
		DIM strTarget as string = strResponse.Substring(iStart, iStop - iStart)
		DIM strTargetFixed as string = _
			strTarget.replace("<a target=""_new"" href=""http", _
			"<a target=""_new"" rel=""nofollow"" href=""http")
		strResponse = strResponse.replace(strTarget, strTargetFixed)
	End If

	'-- send content
	Response.Write(strResponse)
	Response.End()		'prevent conventional response
End Sub

Just replace the standard Application_BeginRequest procedure with this one in the global.asax.vb file (or absorb mine into it.)  It intercepts outgoing comments and dynamically inserts rel=”nofollow” into any contained links.

It won’t prevent comment spam, but it will negate the search engine benefit to the comment spammer, turning the “Vote-For-Me” signs into mere litter in your yard.

One catch:  this breaks .Text’s inline “Remove Comment” links.  You can still delete them in the the admin area’s Feedback section, tho.  Since the comment spam seems to come in waves, that’s an easier way to delete them all at once anyway.

(I guess my next goal is actually preventing comment spam via a captcha or challenge-reponse mechanism, but til then I feel more luxury of time to explore possibilities.)

Bookmark the permalink.

One Response to An observation: Door Store -vs- Vote-For-Me yard signs

  1. Mike says:

    Vote for Me! Hah hah..
    <br>-Mike

Leave a Reply

Your email address will not be published. Required fields are marked *