Take the 2-minute tour ×

I am using the Javascript Client Object model to access some information from a list. Below is the code I am using:

function getDeptInfo(id) {
        //var value = SP.ListOperation.Selection.selectListItem(id, bSelect);
        var ctx = new SP.ClientContext.get_current();
        this.website = ctx.get_web();
        this.listCollection = website.get_lists();
        this.oDeptList = listCollection.getByTitle('NavStructure');
        this.oDeptItem = oDeptList.getItemById(id);
        ctx.load(oDeptItem, 'Department_x003a_photoname', 'Department_x003a_phonenbr', 'Department_x003a_faxnumber', 'Department_x003a_email', 'Department_x003a_hours', 'Department_x003a_siteurl', 'Department_x003a_pictureurl', 'Department', 'ID');

function onSuccess(sender, args) {

        if (oDeptItem.get_item('Department') != null) {

            //hours not in profile list? Hardcoding for now...

            $('#DeptLink').attr('href', oDeptItem.get_item('Department_x003a_siteurl').get_lookupValue());
            $('#deptHead').attr('src', oDeptItem.get_item('Department_x003a_pictureurl').get_lookupValue());


For some reason when I run this in Firefox as an anonymous user it works fine. When I run it from IE as an anonymous user it errors out with:


Does anyone know why this would happen? Any suggestions on how to resolve the error?


I just tested this on a machine that is outside of our domain and everything works fine. it only happens when internal machines run the code. I have also since tested it with Safari and Chrome and neither of those throw errors - only IE.

Also, if I set "Web Page security validation" under General Settings to "Off" IE 8 stops throwing the error. Any idea what could cause this?

share|improve this question
Turning Web Page security validation off is risky. I will have one more go on this question: Try to set IE Security Settings for your site to Local Intranet or Trusted Site. And (just to be 100% sure) do you have any other custom code on this page? –  Vedran Rasol Sep 20 '11 at 21:59
'Web Page security validation' is also quite common when you try to manipulate lookup fields markup from code. –  Vedran Rasol Sep 21 '11 at 0:47
Do you know which statement throws the exception? Is the onSuccess function executed in IE when the exception occurs? –  Anita Boerboom Sep 23 '11 at 20:01
try to attach a debugger in IE (F12 to get developer tools) and see exactly where the security validation occurs. –  Anders Rask Sep 23 '11 at 23:37
ever found and answer - I have a similar issue but then with SP2010 out of the box after a SP2007 upgrade - please see bottom of this social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/… –  Nico de Jong Dec 13 '11 at 14:02

1 Answer 1

If you provided only error in your code I would instantly write: Put FormDigest control inside your page.

<SharePoint:FormDigest ID="MyFormDigest" runat="server"/>

Quote from Security Validation and Making Posts to Update Data


But as far as I see you are not making updates in your code. Take a shot and report back :)

share|improve this answer
Didn't work unfortunately. As you mentioned I am not updating anything, so I don't think this would apply. –  Abe Miessler Sep 13 '11 at 23:18

Your Answer


