SharePoint 2010 - JavaScript Web Service - HTTP 401 authentication error
-
20. srpna 2012 22:21
UPDATE
Folks, I just noticed that even if I remove ALL javascript mentioned in original question, I still get same error. All I am using is JQuery and Nivo Slider for slideshow. I think it may a configuration issue.
--- Original Question is below ---
SharePoint 2010
This code gives me a lot of HTTP 401 Authentication errors. Any help on how to fix will be appreciated. Thanks in advance.
function GetAllImages() { //$("#slideshowPicturePlaceholder").css("display", "block"); // Query without where clause soapEnv += "<Query><OrderBy Override='TRUE'><FieldRef Name='Created' Ascending='FALSE' /></OrderBy></Query>"; var soapEnv = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Body><GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'><listName>SlideShow</listName><query><Query><Where><Or><IsNull><FieldRef Name='Expires'/></IsNull><Geq><FieldRef Name='Expires'/><Value Type='DateTime'><Today /></Value> </Geq></Or></Where><OrderBy Override='TRUE'><FieldRef Name='Order' Ascending='FALSE' /></OrderBy></Query></query><viewFields><ViewFields><FieldRef Name='Expires'/><FieldRef Name='Title'/><FieldRef Name='ows_FileLeafRef'/><FieldRef Name='URL'/></ViewFields></viewFields><rowLimit></rowLimit></GetListItems></soapenv:Body></soapenv:Envelope>"; $.ajax({ url: "/_vti_bin/lists.asmx", type: "POST", dataType: "xml", data: soapEnv, complete: processQueryResults, contentType: "text/xml; charset=utf-8", error: function (xhr) { alert('Error! Status = ' + xhr.status); } }); } function processQueryResults(xData, status) { //Change the below to point to your image library var imageURL = "/SlideShow/"; var itemURL = "/SlideShow/Forms/DispForm.aspx?ID="; //Show XML output (Do not use IE) //console.log(xData); $("#slider").html("") // Not Working in Safari and Chrome //$(xData.responseXML).find("z\\:row").each(function () { // Also working in safari and Chrome $(xData.responseXML).find("[nodeName='z:row']").each(function(i) { var title = $(this).attr("ows_Title"); var imageLink = imageURL + $(this).attr("ows_FileLeafRef").substring($(this).attr("ows_FileLeafRef").indexOf('#') + 1); var itemLink = itemURL + $(this).attr("ows_ID"); //Dubble data in URL (URL%20Description) var linkURL = $(this).attr("ows_URL").split(";#"); var linkURL = $(this).attr("ows_URL").substring(0, $(this).attr("ows_URL").indexOf(",")); //Use target='_blank' in order to open new window var liHtml = "<a href='" + linkURL + "' target='' border='0'><img border='none' src='" + imageLink + "'/></a>"; $("#slider").append(liHtml); }); $("#slider").css("display", "block"); $('#slider').nivoSlider(); } GetAllImages();
- Přesunutý GreggPJ - MSFT 21. srpna 2012 13:37 Moving to correct forum (From:SharePoint 2010 - Using SharePoint Designer, Infopath, and other customization)
- Upravený ran009 27. srpna 2012 19:48
Všechny reakce
-
21. srpna 2012 11:53Moderátor
-
21. srpna 2012 12:03
Hi ran009.
Can you see what items gives the 401? Perhaps you can see this in the eventlog on the SharePoint web server or by using fiddler or similar on the VS box.
Regards
Thomas Balkeståhl - Technical Specialist - SharePoint - http://blog.blksthl.com
Download the SharePoint Branding Project here
Download the SharePoint 2010 Site Settings Explained here -
27. srpna 2012 14:52
Hi ran009,
Greetings! Thanks for the post.
Can you please provide more details about the issue? Please respond to the fowlling queries:-
- Is this an inter-mittent issue or are you always hittting a 401 error?
- So, does the user, who is trying to access the javascript, have read permissions on this site? (I see that you are getting images from a library using the Lists.asmx and the user would require the necessary permissions)
- Where you able to see any related errors in the ULS logs?
By providing these information, it would help us in identifying the root cause and thereby leading us to a quicker resolution.
Regards Kevin ================================================================================ Please remember to click 'Mark as Answer' on the post that helps you or click 'Unmark as Answer' if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
-
27. srpna 2012 17:58
General
- In IE/FF browsers the page loads fine.
- In Chrome the page loads, but continuously asks for login/password. (If we access it via external address like something.com, but it works fine on intranet).
- When I debug with Fiddler, I notice many of my css/js/image files show up with 401 status.Your answers:
1. As explained above.
2. Yes, permissions are fine.
3. 401 is visible in Fiddler, but I do not see any occurrence in ULS.Thanks folks.
-
27. srpna 2012 18:08
When I use Chrome and internet URL for my site (NOT Intranet URL) then:
Using fiddler, I see all of my css/images/js files are being listed with 401. Also all of them get repeated many a time, as long as the Chrome is open. Copy and paste from fiddler is below.
# Result Protocol Host URL Body Caching Content-Type Process Comments Custom 49 304 HTTP something.com /SlideShow/ss3.gif 20 private,max-age=0 Expires: Sun, 12 Aug 2012 18:00:42 GMT chrome:3796 52 304 HTTP something.com /SlideShow/ss3.gif 20 private,max-age=0 Expires: Sun, 12 Aug 2012 18:00:42 GMT chrome:3796 67 304 HTTP something.com /SlideShow/ss2.gif 20 private,max-age=0 Expires: Sun, 12 Aug 2012 18:00:48 GMT chrome:3796 70 304 HTTP something.com /SlideShow/ss2.gif 20 private,max-age=0 Expires: Sun, 12 Aug 2012 18:00:48 GMT chrome:3796 139 304 HTTP something.com /SlideShow/ss3.gif 20 private,max-age=0 Expires: Sun, 12 Aug 2012 18:01:12 GMT chrome:3796 176 304 HTTP something.com /_layouts/AMAT/RESOURCES/JS/am_jquery-1.7.1.min.js 20 max-age=31536000 firefox:6956 206 304 HTTP something.com /SlideShow/ss1.gif 20 private,max-age=0 Expires: Sun, 12 Aug 2012 18:01:37 GMT firefox:6956 231 304 HTTP something.com /_layouts/AMAT/RESOURCES/images/welcome_arrow_black.png 20 max-age=31536000 firefox:6956 232 304 HTTP something.com /_layouts/AMAT/RESOURCES/images/acn_amat_header.gif 20 max-age=31536000 firefox:6956 233 304 HTTP something.com /_layouts/AMAT/RESOURCES/images/ribbon_gradient.gif 20 max-age=31536000 firefox:6956 235 304 HTTP something.com /_layouts/AMAT/resources/images/selbg.png?ctag 20 max-age=31536000 firefox:6956 236 304 HTTP something.com /_LAYOUTS/AMAT/RESOURCES/IMAGES/am_head_resources.GIF 20 max-age=31536000 firefox:6956 224 401 HTTP something.com /_layouts/AMAT/RESOURCES/images/acn_amat_header.gif 20 image/gif firefox:6956 225 401 HTTP something.com /_layouts/AMAT/RESOURCES/images/welcome_arrow_black.png 20 image/png firefox:6956 226 401 HTTP something.com /_layouts/AMAT/RESOURCES/images/ribbon_gradient.gif 20 image/gif firefox:6956 227 401 HTTP something.com /_layouts/AMAT/resources/images/selbg.png?ctag 20 image/png firefox:6956 228 401 HTTP something.com /_LAYOUTS/AMAT/RESOURCES/IMAGES/am_menu_bg.GIF 20 image/gif firefox:6956 229 401 HTTP something.com /_LAYOUTS/AMAT/RESOURCES/IMAGES/am_head_resources.GIF 20 image/gif firefox:6956 217 401 HTTP something.com /_layouts/AMAT/RESOURCES/images/welcome_arrow_black.png 20 image/png firefox:6956 218 401 HTTP something.com /_layouts/AMAT/RESOURCES/images/acn_amat_header.gif 20 image/gif firefox:6956 219 401 HTTP something.com /_layouts/AMAT/RESOURCES/images/ribbon_gradient.gif 20 image/gif firefox:6956 220 401 HTTP something.com /_LAYOUTS/AMAT/RESOURCES/IMAGES/am_menu_bg.GIF 20 image/gif firefox:6956 221 401 HTTP something.com /_layouts/AMAT/resources/images/selbg.png?ctag 20 image/png firefox:6956 222 401 HTTP something.com /_LAYOUTS/AMAT/RESOURCES/IMAGES/am_head_resources.GIF 20 image/gif firefox:6956 214 401 HTTP something.com /_LAYOUTS/AMAT/RESOURCES/IMAGES/am_calendar_icon.PNG 20 image/png firefox:6956 188 401 HTTP something.com /_layouts/AMAT/RESOURCES/JS/milonic_menu_code.js 20 application/javascript firefox:6956 199 401 HTTP something.com /SlideShow/ss1.gif 20 image/gif firefox:6956 200 401 HTTP something.com /SlideShow/ss2.gif 20 image/gif firefox:6956 201 401 HTTP something.com /SlideShow/ss3.gif 20 image/gif firefox:6956 202 401 HTTP something.com /SlideShow/ss-gfp-portfolio.png 20 image/png firefox:6956 203 401 HTTP something.com /SlideShow/ss-news.png 20 image/png firefox:6956 204 401 HTTP something.com /SlideShow/ss-calendar.png 20 image/png firefox:6956 205 401 HTTP something.com /SlideShow/ss-webpart-data-1.png 20 image/png firefox:6956 192 401 HTTP something.com /SlideShow/ss-gfp-portfolio.png 20 image/png firefox:6956 193 401 HTTP something.com /SlideShow/ss-news.png 20 image/png firefox:6956 196 401 HTTP something.com /SlideShow/ss-calendar.png 20 image/png firefox:6956
-
27. srpna 2012 18:10
Folks, I just noticed that even if I remove ALL javascript mentioned in original question, I still get same error. All I am using is JQuery and Nivo Slider for slideshow.
Thanks.
- Upravený ran009 27. srpna 2012 18:11
-
28. srpna 2012 7:47
Hi ran.
In summary:
This only accours in FF?
This occurs with or without Java?
The 401 comes from accessing among other things the /Layouts lirary?I Think that FF as to be configured like IE to authenticate automatically with logged on credentials for a trusted site, else it will keep prompting?
Anyway, since this is only FF and even Chrome works, my thought is that SharePoint probably uis not the bad guy this time...:-)
If you were to try only(not in prod) to set the permissions to internet url to Anonymous, then it would probably work right?
I really hope you find it!
Regards
Thomas Balkeståhl - Technical Specialist - SharePoint - http://blog.blksthl.com
Download the SharePoint Branding Project here
Download the SharePoint 2010 Site Settings Explained here -
19. září 2012 19:54
Hi Ran
Greetings! Thanks for the post.
We would need a considerate amount of troubleshooting to determine the cause and fix the issue, I would advise you to open a ticket with Microsoft Support to help you in a better way.
For more information about Microsoft Support please read the article http://support.microsoft.com/gp/proffaq/en-gb
================================================================================
Please remember to click 'Mark as Answer' on the post that helps you or click 'Unmark as Answer' if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Thanks,
Bharat Rathod,
Microsoft Online Community Support
-
5. října 2012 16:11
It must be something related to SharePoint configuration on my DEV server, when I move it to UAT it works fine. So as of now I consider this resolved.
Thanks all.
- Označen jako odpověď ran009 5. října 2012 16:11