Hi All,
I am hoping that someone might be able to help with an issue I am having with 
the Lists.asmx web service. I am seeing an intermittent unauthorized access 
exception that is thrown when I try to access the web service.

I am using the following code:

XmlDocument xmlDoc = new XmlDocument();
XmlNode queryXml = xmlDoc.CreateNode(XmlNodeType.Element, "Query", "");
queryXml.InnerXml = "<Where><And><Neq><FieldRef Name='ContentType' /><Value 
Type='Choice'>PIIPFolder</Value></Neq>" +
"<Eq><FieldRef Name='Editor' /><Value Type='User'>" + 
HttpUtility.HtmlEncode(thisWeb.CurrentUser.Name) + 
"</Value></Eq></And></Where>";

XmlNode fieldsXml = xmlDoc.CreateNode(XmlNodeType.Element, "ViewFields", "");

XmlNode optionsXml = xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions", "");
optionsXml.InnerXml = "<ViewAttributes Scope='Recursive' />";

mossListService queryService = new mossListService();
queryService.Url = thisWeb.Url + "/_vti_bin/Lists.asmx";
queryService.UseDefaultCredentials = true;

string position = null;
line 157: XmlNode res = queryService.GetListItems("Pages", null, queryXml, 
fieldsXml, null, optionsXml, thisWeb.ID.ToString());

on the highlighted line 157 the following exceptions are observed in this order:

line 157: A first chance exception of type 'System.Net.Sockets.SocketException' 
occurred in System.dll
Additional information: No connection could be made because the target machine 
actively refused it

line 157: A first chance exception of type 'System.Net.WebException' occurred 
in System.dll
Additional information: Unable to connect to the remote server

line 157: A first chance exception of type 'System.Net.WebException' occurred 
in System.dll
Additional information: Unable to connect to the remote server

line 157: A first chance exception of type 'System.Net.WebException' occurred 
in System.dll
Additional information: The remote server returned an error: (401) Unauthorized.

This only occurs sometimes and refreshing the page will usually correct it.

Thanks again for your help
Roger


Roger Noble
Developer | Oconics Pty Ltd | w: 
http://www.oconics.com<http://www.oconics.com/> | p: +61 8 8431 9347 | f: +61 8 
8364 0190 | m: 0447 444 407 | a: Suite 2, 154 Fullarton Rd, Rose Park, SA 5067, 
AUSTRALIA

[cid:image001.png@01C8D768.BE9278E0]       [cid:image002.gif@01C8D768.BE9278E0]


IMPORTANT NOTICE: This e-mail message is intended to be received only by 
persons entitled to receive the confidential information it may contain. E-mail 
messages to clients of Oconics Pty Ltd may contain information that is 
confidential and legally privileged. Please do not read, copy, forward or store 
this message unless you are an intended recipient of it. If you have received 
this message in error, please forward it back to the sender and delete it 
completely from your computer system.



------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.

Powered by mailenable.com

<<inline: image001.png>>

<<inline: image002.gif>>

Reply via email to