CKS:EBE Integrated Authentication for Comments

Topics: Enhanced Blog Edition
Aug 11, 2008 at 11:09 PM
Could someone tell me how I might use integrated authentication for comments, rather than having the user type in their Name/email adress?

What I have done so far:
  1. I have the CKS:EBE setup on a Intranet site
  2. annonymous access is turned off
  3. i added the default sharepoint welcome control to the top of the page: <wssuc:Welcome id="IdWelcome" runat="server" EnableViewState="false"></wssuc:Welcome>
  4. An I can see that I am being authenticated properly and my name is showing up.

But the comments list still shows that all the comments are being created by the system account.

I have looked at the webform in the theme.master for some clues on how to do this, but I am stuck. can someone point me in the right direction?


Aug 12, 2008 at 6:21 PM

Hi David,

You're close!  In the theme.master, where the EBE:CommentForm control is, set AllowAnonymousComments off like:

<EBE:CommentForm AllowAnonymousComments="false" runat="server"><Template>

In the CommentForm source code there is a conditional for anonymous, and it elevates the privileges and uses the system account if anonymous is allowed, otherwise it uses the poster's credentials.

IMO, this should be a setting in the CKS:EBE settings page, but the only way I know right now to do it is to modify the CommentForm control.

Mike Sharp

Aug 12, 2008 at 10:38 PM
Great solution, unfortunately that property is not present in the release version of EBE as I am getting this error:

Parser Error Message: Type 'CKS.EBE.WebControls.CommentForm' does not have a public property named 'AllowAnonymousComments'.

Looks like it was added to the code base on July 23rd.  I hope I can figure out how to update it. Any recommendations on what the most stable release is after July 23rd?


Aug 13, 2008 at 12:01 AM
Bummer!   I tested my fix using the latest source, but it wasn't the easiest thing getting it running in my test environment.  There are bugs in the CreateManifest.vbs and CreateCabDDF.vbs post build scripts.  Once I figured out what was going on, it was easy to fix, but it's not a good sign.  Basically they're including the .svn folders and files in the cab.  If you do try to build it, you'll need to make some changes (in bold below).  I also modified install.bat to uninstall the solution before re-installing it.  See below.

I wish I could tell you whether the current state of the source tree is stable or not, but I didn't test it extensively.  On the other hand, if it's functionality you need, then you can either add the anonymous comment changes to the 2.0 release (shouldn't be too difficult, I think), or try the latest version and test the heck out of it!  ;^)

Mike Sharp


for each oSub in oFolder.SubFolders

if (Instr(oSub.Path, "_tfs")=0 and oSub.Name <> ".svn") then

EnumFolder oSub.Path, sRelativePath + oSub.Name

end if




for each oSub in oFolder.SubFolders

if (oSub.Name <> ".svn") then

EnumFolder oSub.Path, sRelativePath + oSub.Name

end if


:usage - reinstall.bat, or reinstall.bat http://webapp/ http://webapp/blogsite

@echo off
if "%1" == "" goto UrlPrompt
if "%2" == "" goto UrlPrompt
set webappurl=%1
set blogsiteurl=%2
goto Main

echo Enter URL of the blog site's web application (e.g., http://blogs/):
set /p webappurl=
echo Enter the relative URL of the blog site in the web application (e.g., /myblog):
set /p blogsiteurl=
set blogsiteurl=%webappurl%%blogsiteurl%

set stsadm="%programfiles%\common files\microsoft shared\web server extensions\12\bin\stsadm.exe"

echo Removing old solution

%stsadm% -o deactivatefeature -filename "CKS EBE WebApp\feature.xml" -url "%webappurl%" -force
%stsadm% -o deactivatefeature -filename "CKS EBE\feature.xml" -url "%blogsiteurl%" -force

%stsadm% -o uninstallfeature -filename "CKS EBE WebApp\feature.xml" -force
%stsadm% -o uninstallfeature -filename "CKS EBE\feature.xml" -force

%stsadm% -o retractsolution -name CKS.EBE.wsp -immediate
%stsadm% -o execadmsvcjobs
%stsadm% -o deletesolution -name CKS.EBE.wsp -override

echo Deploying solution to %blogsiteurl%
@echo on

%stsadm% -o addsolution -filename CKS.EBE.wsp
%stsadm% -o deploysolution -name CKS.EBE.wsp -allowGACDeployment -force -immediate
%stsadm% -o execadmsvcjobs

%stsadm% -o activatefeature -filename "CKS EBE WebApp\feature.xml" -url "%webappurl%" -force

%stsadm% -o activatefeature -filename "CKS EBE\feature.xml" -url "%blogsiteurl%" -force


Aug 13, 2008 at 11:52 PM

Two steps forward one step back.

I was able to compile the commentfrom web control successfully with the changes to it, and the comment form is now capturing the authticated user in the "Created By" field.  Yes!!!!

Unfortunatly, I can't figure out how to get the "Created by" user name to show up in the comments list.  i went into the comments.xsl and changed:

<xsl:value-of select="Title"/> to <xsl:value-of select="Created By"/>  --- that didn't work so I changed the comment field name to "Author"

and tried <xsl:value-of select="Author"/>  --- no dice, then I tried:

 <xsl:value-of select="@Author"/> --- Still no luck

Am I barking up the wrong tree?

Aug 14, 2008 at 8:33 PM

Hi David,

You're using the right approach, but the XML used for all of the transforms is built from a CAML query, and you need to add the field to the query first.  Then you can handle it in the XSLT.  To do this, go to PostComment.cs and modify the ViewFieldsXml like (adding the <FieldRef Name='Author'/> element):

ViewFieldsXML = "<FieldRef Name='Title'/><FieldRef Name='_ModerationStatus'/><FieldRef Name='Created'/><FieldRef Name='Author'/><FieldRef Name='CommentUrl'/><FieldRef Name='Body'/><FieldRef Name='PostTitle'/>";

<FieldRef Name='Author'/> is the internal field name for the "Created By" field.  Don't even ask how long it took me to figure that out!  ;^)

Anyway, now it will show up in the XML to the transform, and you can do whatever you want with it in the XSLT.  One caveat, it shows up as this:

<Author>1;#Mike Sharp</Author>

so you'll need to process that a bit...

Mike Sharp

Aug 15, 2008 at 3:23 PM
Thanks so much Mike!

That worked perfectly.  For anyone that wants to duplicate it, here is the modified xsl:

<xsl:stylesheet version="1.0"
 xmlns:xsl="" exclude-result-prefixes="str date">

<xsl:output omit-xml-declaration="yes" />

<xsl:param name="IsBlogOwner" />
<xsl:param name="RelativeUrl" />

<xsl:template match="/">

 <div class="blogCommentContainer" >
  <h3 class="comments">Comments</h3>
  <xsl:apply-templates select="rows/row"/>

<xsl:template match="row">
  <span class="commentDate">
   <xsl:variable name="authorName" select="str:split(Author, '#')"/>
   <a href="{CommentUrl}"><xsl:value-of select="$authorName[2]"/>|</a> commented on <xsl:variable name="publishedDate" select="date:parseDate(Created, 'yyyy-MM-dd HH:mm:ss')"/>
   <xsl:value-of select="date:format-date($publishedDate, 'EEEE, d-MMM-yyyy')"/>
  <div class="commentText">
   <xsl:value-of select="Body" disable-output-escaping="yes" />
  <hr class="commentSep" />


Aug 15, 2008 at 6:42 PM

Glad to help!

Actually, I've been thinking it would be nice if the XSLT were all stored in a document library, so the web site admin could update them without having to redeploy the project.  That way different site collections or web applications could use different XSLT, since the file itself would be stored in the context of the site collection.  The caching mechanism is based on an expiration time, so it shouldn't matter that the file isn't on the filesystem. 

Mike Sharp

Aug 15, 2008 at 10:20 PM


Thanks for answering this...some great advice & suggestions.

Just to add a couple of comments...

The XSL would perform faster using <xsl:value-of select="substring-after(Author, ';#')/> rather than using the str: methods.

With the current build (I'm getting a release for it available) you can specify the Theme library for the site collection, rather than individual blogs.

I will look at making tha anonymous comments a setting for the blog rather than the control setting it currently is.

Regards, Vince

PS anything I check-in should be good workable code and can be considered stable and the 'next release'

Aug 16, 2008 at 1:24 AM
Thanks Vince, that's good news.    I like the idea of making allowAnonymous a setting. 

As far as themes go, for an internal company blog, some might like the ability to change the theme being disabled altogether, meaning it would be configured by IT, and users would have to stick to the organization's brand, especially since some of the themes appear to be missing functionality.

Are you only working on the CKS:EBE?  I was specifically wondering about the CKS:IEE, which doesn't seem to have much activity.  I have a few fixes for that branch. 

Mike Sharp

Aug 16, 2008 at 11:41 AM

That's why themes can be defined at the site collection now.

In a corporate environment I remove the settings altogether and with the latest version you can create your own site template, activate the EBE in the template and set the EBE settings in the template. This allows for a corporate template with all the settings defined.

I only have time for the EBE. If you contact Lawrence Liu then he will point you to the right person to talk to about the IEE...all contributions are greatly received and when one person starts on a project it motivates other to join in.

Apr 1, 2009 at 8:37 AM
Hi Guys,

I'm been reading your posts above and I'm having a problem getting the Post Comments form to populate the comments list in sharepoint that has a new column list field called "Department".

I have updated the PostComments.cs file with the name of my new "Department" field and then deployed the solution again.

ViewFieldsXML =

"<FieldRef Name='Title'/><FieldRef Name='_ModerationStatus'/><FieldRef Name='Created'/><FieldRef Name='CommentUrl'/><FieldRef Name='Body'/><FieldRef Name='PostTitle'/><FieldRef Name='Department'/>";


I updated my theme.master file with the following:

      <p><label for="Department">Department (required)</label><br/>
      <asp:TextBox runat="server" id="Department" /> </p>

but when I add a comment to a blog post and put in a value for the "Department" field I don't see it appearing in the Sharepoint Comments List.

Any ideas what I might be doing wrong?

Kind Regards,


Apr 1, 2009 at 11:15 PM

You will need to update the Form class as well so that it updates that field in the list.

Have a look at CommentForm.cs

private void AddComment(bool bIsSpam)

Apr 2, 2009 at 12:05 AM
Hi Vince,

I've updated CommentForm.cs as follows and redeployed the build but it still doesn't add the value into the Sharepoint List when I create a comment:



string CommentDept { get { return TextBoxValue("idDept"); } }

and then in the AddComment method:



"Department"] = CommentDept;

I then updated theme.master to reflect that I've used idDept:

<p><label for="idDept">Department (required)</label><br/>
      <asp:TextBox runat="server" id="idDept" /> </p>

Any ideas what I might be doing wrong still?

Kind Regards,



Apr 2, 2009 at 12:12 AM

A few things...

1. Run DebugView to see if there are any errors.

2. Add you own System.Diagnostics.Trace statements to ensure your code is being called.

3. Check the Internal name of your new column, sometimes it can be different (Department1 not just Department).

4. Can you attach a debugger?

Apr 2, 2009 at 12:30 AM
Hi Vince,

It was a deployment issue. I redeployed the solution and then deactivated/activated the feature and it is now working as expected. Sharepoint must've cached something perhaps?

Thanks for your help you are a lifesaver!

Apr 2, 2009 at 12:32 AM
Stupid question, but did you start/stop IIS after copying over the new dll? 

Apr 2, 2009 at 12:46 AM
No problem, glad you got it working.

Apr 2, 2009 at 1:00 AM
Hi Vince,

Me again. I noticed that the latest build of the EBE has a "Search" function. Does this mean you can add the Sharepoint Search Bar into your blog?

If so, how do you implement it?

Apr 2, 2009 at 1:04 AM
It has support for MSSX so you can create a search results page and place the search results control on that page. You can then specify XSL from your theme folder to transform the XML search results.

So yes you can, there is already a SearchBox control within the EBE which you can use to re-direct to the search results page.

Apr 2, 2009 at 3:50 PM
Nice.  Could you give a little detail on adding another page?  Would i just use an existing page (say Category.aspx) as a template, and modify it, put in the search results control, etc?

Apr 2, 2009 at 4:42 PM
Hust use SP designer. Copy one of the exisitng pages from the root of the blog site and put the search results control in there (you will need to reference the CKS.EBE.Search.dll).

In your master page put the existing <EBE:SearchBox /> (from memory) and set it to redirect to your new search results page (search.aspx??).

The search box will perform the re-direct with ?q=<term> in the query string. The search results control looks for the 'q' query string value.

Should just work (at least it does for me in the projects I have used it).

Apr 2, 2009 at 6:01 PM
ok, trying to do this, and am trying to figure it out on my own, but... how do i reference the dll?  just in the page, or does it have to be referenced in the solution itself?  Is it something like this in the aspx page?

<%@ Register Tagprefix="EBE" Namespace="CKS.EBE.WebControls" Assembly="CKS.EBE, Version=, Culture=neutral, PublicKeyToken=3e8b700c069fb747" %>

Thanks for all the help,
Apr 2, 2009 at 7:14 PM
Yes, it will be...

<%@ Register Tagprefix="EBESearch" Namespace="CKS.EBE.Search" Assembly="CKS.EBE.Search, Version=, Culture=neutral, PublicKeyToken=3e8b700c069fb747" %>


<EBESearch:SearchBox runat="server" ResultsUrl="~site/search.aspx" />

search page

<EBESearch:SearchSqlQueryResults runat="server" Xsl-XslName="search.xsl" />

Apr 2, 2009 at 7:36 PM
Much thanks.  Of course it doesn't work for me. 

An error occurred during the processing of . Could not load file or assembly 'CKS.EBE.Search, Version=, Culture=neutral, PublicKeyToken=3e8b700c069fb747' or one of its dependencies. The system cannot find the file specified.

I think that the Visual Studio 2008 .sln project file doesn't include the Search portion.  When I first started trying to build this i was using 2005, but it wouldn't build due to errors, and so had to do it with 2008 (something about automatic properties I think).  And when I opened the project in 2008, it doesn't show the Search portion.  At the time that wasn't my concern, and sort of forgot about it.  But now I think it's back to haunt me.

Can I add that part of the solution into the .sln file in 2008 and add it to the build?

Apr 2, 2009 at 7:42 PM
Or open the 2005 .sln and let it convert to 2008?
Apr 2, 2009 at 8:27 PM
Whatever is easiest, you just need to build the Search DLL and add it to the GAC.

Apr 2, 2009 at 11:06 PM
Thanks, huge progress today.

Got all the search stuff setup, I think, and dll in GAC, safe controls in web.config.  No more errors.  Have to write search.xls, but I can see that I'm getting results from search.aspx that I created if I go to it directly (with ?k=<term>).

BUT, don't see the searchbox on my page.  In theme.master I used:

<EBESearch:SearchBox runat="server" ResultsUrl="~site/search.aspx"/>

No errors, just nothing shows.

Thanks again,
Nov 17, 2009 at 1:18 AM


I need to make some changes in the postcomment.cs so as to modify the ViewFieldsXML but I have no idea where to find that file to edit? Is anyone able to help me with this please?


Dec 2, 2009 at 4:37 AM


I am trying to add this AllowAnonymousComments option into my site. Where can I get the source code for Version 2.0 of EBE? We are already in production so I want no changes except the one I make to this form

I looked in the source code section but it was not obvious which version was 2.0 Final


Dec 2, 2009 at 1:20 PM
callumbundy wrote:


I am trying to add this AllowAnonymousComments option into my site. Where can I get the source code for Version 2.0 of EBE? We are already in production so I want no changes except the one I make to this form

I looked in the source code section but it was not obvious which version was 2.0 Final


I think you need at least the beta version 2.5 to add the AllowAnonymousComments option to your site. Or you could try looking at the source codes and download the one that is closest to the date that the version 2.0 is being released. Hope that helps.

May 11, 2010 at 12:21 PM

As far as I can see, the AllowAnonymousComments option is not available in the final (Mar 3, 2008) release. Is there a 2.5 beta release that I cannot find? What is the final suggested workaround for automatically using the logged-in user's name when posting comments?