I am trying to delete a comment in the UGC. I am getting 403 forbidden error.
this is the error from fiddler (DELETE http://IISURLForCommunitYWebService/odata.svc/Comments(Id=35))
HTTP/1.1 403 Forbidden
Set-Cookie: TAFSessionId=tridion_660a4819-15ea-4951-8529-6f2bc2c7e458; path=/; HttpOnly
Set-Cookie: TAFTrackingId=tridion_fd5c0530-07a7-46a6-b73f-d2ba2dbf1118; expires=Fri, 01-Jan-2100 05:00:00 GMT; path=/; HttpOnly
DataServiceVersion: 1.0;
X-AspNet-Version: 4.0.30319
Set-Cookie: ASP.NET_SessionId=ztbntutkyudhrtms1mksmwb1; path=/; HttpOnly
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code></code>
<message xml:lang="en-US">The appropriate delete claim has not been set.</message>
</error>
I am using UGC Content delivery web service api as below. Is it the right way to delete a comment ?
public GenericResultSet DeleteComment(int CommentId) //CommentId for UGC comment
{
GenericResultSet result = new GenericResultSet();
result.Metadata = new Dictionary<string, object>();
try
{
var js = new JavaScriptSerializer();
Comment ugcData = new Comment();
ugcData.Id = CommentId;
ugcData.User = new User();
ugcData.User.Id = "Zj0JF16vgDWktiDVHK6hcQ";//This External ID for our application
ugcData.User.Name = "XYZ";
ugcCall.UploadString("/Comments", "DELETE", js.Serialize(new { d = ugcData }));
result.Metadata.Add(Common.STATUS_MSG.Replace("@", ""), "Success");
result.Metadata.Add(Common.STATUS_CODE.Replace("@", ""), 1);
}
catch (Exception ex)
{
logger.Info("Unable to DELETE a comment on Page/component -" + CommentId + " -" + ex.StackTrace);
result.Metadata.Add(Common.STATUS_MSG.Replace("@", ""), "Unable to Post a comment on Page/component -" + CommentId + " -" + ex.InnerException);
result.Metadata.Add(Common.STATUS_CODE.Replace("@", ""), -1);
}
return result;
}
and also i saw there is helper methods for UGC to delete a comment, but this also throwing the same error.
Tridion.ContentDelivery.UGC.WebService.WebServiceHelper.RemoveComment(commentId)
;
In my cd_ambient_conf(community web service), i have set like this
<GloballyAcceptedClaims>
<Claim Uri="taf:tracking:id"/>
</GloballyAcceptedClaims>
- Do I need to set any authorization header to know the owner of the comment ?
- I am not using aspx control for commenting, as i have diffrent UI and requirements.
- When we create a new comment (via api), we are setting external id to our front end application SSO login id, so that we can query later. Can we set this login id for authorization for UGC Delete service ?
CD_CORE UGC LOG
2015-07-07 03:12:16,373 DEBUG AmbientRuntime - Putting the default cookie claim value into the ClaimStore(cookieName:CookieClaim, cookieValue:true)
2015-07-07 03:12:16,373 DEBUG AmbientRuntime - Putting the default cookie claim value into the ClaimStore(cookieName:CookieClaim, cookieValue:true)
2015-07-07 03:12:16,373 DEBUG ClaimStore - put: uri=CookieClaim, value=true
2015-07-07 03:12:16,374 DEBUG AmbientRuntime - Ambient Data context initialization.
2015-07-07 03:12:16,374 DEBUG AmbientRuntime - Ambient Data context initialization.
2015-07-07 03:12:16,374 DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@cde267b, thread: Thread-2
2015-07-07 03:12:16,374 DEBUG ClaimStore - put: uri=taf:request:uri, value=/odata.svc/Comments(Id=18)
2015-07-07 03:12:16,374 DEBUG ClaimStore - put: uri=taf:request:full_url, value=http://localhost:92/odata.svc/Comments(Id=18)
2015-07-07 03:12:16,374 DEBUG ClaimStore - put: uri=taf:request:headers, value={host=[Ljava.lang.String;@6a98947d, content-type=[Ljava.lang.String;@14b1ba40, user-agent=[Ljava.lang.String;@709d3bd7}
2015-07-07 03:12:16,375 DEBUG ClaimStore - put: uri=taf:request:cookies, value={ASP.NET_SessionId=bdhw4rwa1o3wpobsfocidaxl}
2015-07-07 03:12:16,375 DEBUG ClaimStore - put: uri=taf:request:parameters, value={QUERY_STRING=[Ljava.lang.String;@d8d2641, CONTENT_TYPE=[Ljava.lang.String;@239870f1}
2015-07-07 03:12:16,376 DEBUG ClaimStore - put: uri=taf:server:variables, value={SERVER_PORT=92, REMOTE_HOST=::1, SERVER_PROTOCOL=HTTP/1.1, DOCUMENT_ROOT=D:\Websites\UGCCommunity, REQUEST_METHOD=DELETE, SCRIPT_NAME=/odata.svc, REMOTE_ADDR=::1, SECURE=false, PATH_TRANSLATED=D:\Websites\UGCCommunity\odata.svc, SERVER_NAME=localhost, AUTH_TYPE=, REMOTE_USER=}
2015-07-07 03:12:16,377 DEBUG AmbientRuntime - Generated new sessionId: tridion_37c96b42-ddba-4810-b974-a636f8da54ab
2015-07-07 03:12:16,377 DEBUG AmbientRuntime - Generated new sessionId: tridion_37c96b42-ddba-4810-b974-a636f8da54ab
2015-07-07 03:12:16,380 DEBUG AmbientRuntime - Generated new trackingId: tridion_af05d668-e210-4223-ac92-35729aab612a
2015-07-07 03:12:16,380 DEBUG AmbientRuntime - Generated new trackingId: tridion_af05d668-e210-4223-ac92-35729aab612a
2015-07-07 03:12:16,382 DEBUG ClaimStore - put: uri=taf:session:id, value=tridion_37c96b42-ddba-4810-b974-a636f8da54ab
2015-07-07 03:12:16,383 DEBUG ClaimStore - put: uri=taf:tracking:id, value=tridion_af05d668-e210-4223-ac92-35729aab612a
2015-07-07 03:12:16,388 DEBUG ClaimStore - put: uri=taf:session:attributes, value={}
2015-07-07 03:12:16,388 DEBUG AmbientRuntime - Begin processing cookie claims.
2015-07-07 03:12:16,388 DEBUG AmbientRuntime - Begin processing cookie claims.
2015-07-07 03:12:16,388 DEBUG AmbientRuntime - Cookie forwarding is enabled: True
2015-07-07 03:12:16,388 DEBUG AmbientRuntime - Cookie forwarding is enabled: True
2015-07-07 03:12:16,388 DEBUG AmbientRuntime - Cookie forwarding for account is set to: False
2015-07-07 03:12:16,388 DEBUG AmbientRuntime - Cookie forwarding for account is set to: False
2015-07-07 03:12:16,391 DEBUG AmbientRuntime - IP address is in the white list: False
2015-07-07 03:12:16,391 DEBUG AmbientRuntime - IP address is in the white list: False
2015-07-07 03:12:16,391 DEBUG AmbientRuntime - Cookie forwarding for current request is allowed: False
2015-07-07 03:12:16,391 DEBUG AmbientRuntime - Cookie forwarding for current request is allowed: False
2015-07-07 03:12:16,391 DEBUG AmbientRuntime - Dispatching OnSessionStart event
2015-07-07 03:12:16,391 DEBUG AmbientRuntime - Dispatching OnSessionStart event
2015-07-07 03:12:16,392 DEBUG AmbientRuntime - Dispatching OnRequestStart event
2015-07-07 03:12:16,392 DEBUG AmbientRuntime - Dispatching OnRequestStart event
2015-07-07 03:12:16,392 DEBUG BasePostClaimProcessor - No user claim set, not allowing request.
2015-07-07 03:12:16,392 DEBUG AmbientRuntime - Trying to get the cookie claim using cookieClaimName:CookieClaim
2015-07-07 03:12:16,392 DEBUG AmbientRuntime - Trying to get the cookie claim using cookieClaimName:CookieClaim
2015-07-07 03:12:16,393 DEBUG AmbientRuntime - CookieClaim value:True
2015-07-07 03:12:16,393 DEBUG AmbientRuntime - CookieClaim value:True
2015-07-07 03:12:16,393 DEBUG AmbientRuntime - CookieClaim is true! Writing the tracking cookie to the headers.
2015-07-07 03:12:16,393 DEBUG AmbientRuntime - CookieClaim is true! Writing the tracking cookie to the headers.
2015-07-07 03:12:16,394 DEBUG ODataService - ODATA.NET: Removing entity with path: Comments(Id=18)
2015-07-07 03:12:16,394 DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@cde267b, thread: Thread-5
2015-07-07 03:12:16,396 DEBUG AmbientRuntime - Ambient Data context initialization.
2015-07-07 03:12:16,396 DEBUG AmbientRuntime - Ambient Data context initialization.
2015-07-07 03:12:16,397 DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@cde267b, thread: Thread-0
2015-07-07 03:12:16,397 DEBUG AmbientRuntime - Ambient Data context initialization.
2015-07-07 03:12:16,397 DEBUG AmbientRuntime - Ambient Data context initialization.
2015-07-07 03:12:16,397 DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@cde267b, thread: Thread-0
2015-07-07 03:12:16,397 DEBUG AmbientRuntime - Dispatching OnRequestEnd event
2015-07-07 03:12:16,397 DEBUG AmbientRuntime - Dispatching OnRequestEnd event
2015-07-07 03:12:16,397 DEBUG WebContext - setCurrentClaimStore: null, thread: Thread-0
any help is good for me. I am unable to find the solution.