-2

I am working on a social networking site where people can comment on posts, photos, videos etc. Commenting is similar to facebook commenting system, but I am worried about that it might be abused by some people. People can type one word and press enter or if someone is logged in, can write a small javascript program and post unlimited number of comments on any post, ultimately it is a form posting to a controller method.

What is the best way to handle this situation? How could I implement this system?

p.campbell
  • 98,673
  • 67
  • 256
  • 322
Parminder
  • 3,088
  • 6
  • 37
  • 61
  • 2
    Please look at this question: http://stackoverflow.com/questions/33969/best-way-to-implement-request-throttling-in-asp-net-mvc – detroitpro Dec 22 '11 at 04:21
  • @Detroitpro thanks for that, I wana make your comment as answer. how would i do that. – Parminder Dec 22 '11 at 04:37

2 Answers2

1

A couple of thoughts spring to mind -

Firstly implement a post quality control system. This is up to you, but perhaps something like a minimum character/word limit? Obviously a one-word comment might be completely acceptable, so it's up to yourself. Another alternative might be a regular expression to confirm the post contains at least one valid English (?) word, or a search against a known list of blacklisted websites.

A nice little bit of server-side validation could handle that in MVC :)

Secondly you can implement a time limit on new posts, nothing huge perhaps only a few milliseconds, or a second or so. It helps mitigate a denial of service, since any request from a particular IP address will basically not be processed if it comes too closely behind another. This is perhaps something that would be dealt with again in server-side validation but outside of the controller - a separate set of classes would be responsible for keeping track of what was posted and what constitutes a 'spammy' comment based on timeframe.

A third option would be to implement the dreaded CAPTCHA (perhaps ReCaptcha) on each comment, although from a Usability perspective that would really be annoying for users ;) Easy to implement and lots of details on the ReCaptcha site, including .Net libraries IIRC.

A fourth option might be to include a comment moderation system, so comments must be approved by the OP before they appear. Very similar to most blogs.

A fifth option could be a facility to ban based on IP addresses to help cut out known spammers. Similarly there are various APIs out there to help filter comments based on spamminess of content such as Akismet.

It's a pretty big topic, so sorry for the general-purpose nature of the suggestions. I hope a couple might be useful :)

0

Use captchas if someone is posting "too much things in too few time".

Force some minimum interval between consecutive posts too.