vb.net - Passing current user for Windows Auth on an Intranet web service -


i have visual basic application obtains xml intranet web service, works fine. there 1 page requires windows authentication (due security). web service running on apache tomcat 7 - using waffle use windows auth. works fine in web browser, internet explorer silently logs in user. (this method used)

here code i'm using obtain xml provided string url.

 dim xmlresolver xmlurlresolver = new xmlurlresolver()  windowsidentity.getcurrent.impersonate()  xmlresolver.credentials = credentialcache.defaultcredentials  dim settings xmlreadersettings = new xmlreadersettings()  settings.ignorecomments = true  settings.xmlresolver = xmlresolver  dim xmlreader xmlreader = xmlreader.create(surl, settings)   while (xmlreader.read())  //parsing code  loop  xmlreader.close() 

this works fine getting xml unprotected pages, following exception when attempting retrieve xml secured page:

system.net.webexception: remote server returned error: (401) unauthorized.    @ system.net.httpwebrequest.getresponse()    @ system.xml.xmldownloadmanager.getnonfilestream(uri uri, icredentials credentials, iwebproxy proxy, requestcachepolicy cachepolicy)    @ system.xml.xmldownloadmanager.getstream(uri uri, icredentials credentials, iwebproxy proxy, requestcachepolicy cachepolicy)    @ system.xml.xmlurlresolver.getentity(uri absoluteuri, string role, type ofobjecttoreturn)    @ system.xml.xmltextreaderimpl.finishinituristring()    @ system.xml.xmltextreaderimpl..ctor(string uristr, xmlreadersettings settings, xmlparsercontext context, xmlresolver uriresolver)    @ system.xml.xmlreadersettings.createreader(string inputuri, xmlparsercontext inputcontext)    @ system.xml.xmlreader.create(string inputuri, xmlreadersettings settings, xmlparsercontext inputcontext)    @ system.xml.xmlreader.create(string inputuri, xmlreadersettings settings)    @ publicwebservicetester.frmalarms.raisealarm() in ..\frmalarms.vb:line 44 

it seems me user isn't passed through correctly.


Comments