I have implemented a Spam filter based on the Tridion UGC API, and I now wish to configure my UGC web service to make use of it. So far the spam filter appears not to be invoked when adding a comment via the service. My current configuration is as follows:
I have placed the assembly DLL in the bin directory of the web service application. I have edited the web.config
file to add the following:
<appSettings>
<add key="Comment.SpamFilter.Implementation" value="UGCDemo.BadWordsFilter"/>
<add key="Comment.SpamFilter.Assembly" value="SpamFilter.dll"/>
</appSettings
I am able to verify the name of the implementation class and of the assembly, as you can see by the following PowerShell output:
PS C:\inetpub\LiveCDService
> ls
Directory: C:\inetpub\LiveCDService
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 5/28/2012 5:05 PM bin
-a--- 11/4/2011 3:38 PM 212 access_token.svc
-a--- 11/4/2011 3:38 PM 323 Global.asax
-a--- 11/4/2011 3:38 PM 138 linking.svc
-a--- 11/4/2011 3:38 PM 198 odata.svc
-a--- 5/28/2012 5:41 PM 11073 Web.config
-a--- 5/28/2012 5:10 PM 11073 Web.config~
PS C:\inetpub\LiveCDService
> add-type -path .\bin\SpamFilter.dll
PS C:\inetpub\LiveCDService
> $foo = new-object UGCDemo.BadWordsFilter
PS C:\inetpub\LiveCDService
> $foo | gm
TypeName: UGCDemo.BadWordsFilter
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
ValidateComment Method Tridion.ContentDelivery.UGC.Web.Model.Comment Valid
I have the logging in debug mode, and I can't see any output that might relate to loading a spam filter assembly or anything similar. What other configuration changes might I need to get this functionality working? What other tests might I apply to discover more about the problem?
I think the problem is trying to install the SpamFilter in the Webservice. As is stated in the documentation, the SpamFilter must be configured in the Web Application:
Raul is right....the SpamFilter for UGC needs to be configured on the actual Website and not in the UGC WebService. Note that the SpamFilter is called by the UGC ServerControls before any call to the UGC WS is made. Check the official docs for more details
Hope this helps.