Code wont run unless I'm logged in
I just want to update the ViewCount...
Line 56: Document doc = lm.GetDocument(documentID); Line 57: doc.ViewsCount = doc.ViewsCount + 1; Line 58: lm.SaveChanges(); Line 59: Line 60: Response.Redirect(lm.GetItemUrl(doc) + doc.Extension + "?Status=Master");
The code fails, because you cannot make modifications to an object with the api if the current user ( which in your case is anonymous ) is not granted with modify permissions.
You can use Manager.Provider.SuppressSecurityChecks = true; in your code to allow SaveChanges to be processed then set SuppressSecurityChecks back to false which is its initial state
All the best,
the Telerik team