M
Mark Harris
Hi all
Have spent an annoying afternoon with this problem, and am wondering if anyone else has come accross it or whether it's known about.
Scenario is, i have NetworkCred object in one function, it get's passed BYREF to a function in another object ... which runs off to the registry to get the (encrypted) UID and Password. This function then decrpyts the UID / PWD, sets the properties on the NetwordCred object, and returns to the starting function. However, if i then try to use this NC object on a Web Service Proxy, i get a 401 Access Denied from my "Windows Auth"'ed webservice.
Note : When u check the username and Password properties of the NC object in the main function, they are saturated with the correct values.
However, if i dont call the external function that goes to the registry, and C&P it's code into the main function (ie. No need to pass the NC object byref!) and use the NC object on the Proxy, it runs the call perfectly well with no annoying 401's!!
eg.
'get login credentials for the webservice
objBroker = New DatabrokerServices.DatabrokerService 'the web service proxy
objUtil.GetServiceURL(mstrSERVICE_DATABROKER, strURL)
objBroker.Url = strURL
objCred = New System.Net.NetworkCredential
blnReturn = objUtil.GetServiceCredentials(mstrSERVICE_DATABROKER, objCred)
objBroker.Credentials = objCred.GetCredential(New Uri(strURL), "Negotiate")
strResponseEnc = objBroker.Execute(strCommandEnc) ' Fails with a 401, uid / pwd properties have correct values
********
whereas, this code works fine ... and yet it's looking at the same registry settings!?
objCred = New System.Net.NetworkCredential
objCred.Username = objUtil.GetServiceUID(mstrSERVICE_DATABROKER)
objCred.Password = objUtil.GetServicePWD(mstrSERVICE_DATABROKER)
objBroker.Credentials = objCred.GetCredential(New Uri(strURL), "Negotiate")
strResponseEnc = objBroker.Execute(strCommandEnc)
**************************************
Explanations anyone??
Cheers
Mark
Have spent an annoying afternoon with this problem, and am wondering if anyone else has come accross it or whether it's known about.
Scenario is, i have NetworkCred object in one function, it get's passed BYREF to a function in another object ... which runs off to the registry to get the (encrypted) UID and Password. This function then decrpyts the UID / PWD, sets the properties on the NetwordCred object, and returns to the starting function. However, if i then try to use this NC object on a Web Service Proxy, i get a 401 Access Denied from my "Windows Auth"'ed webservice.
Note : When u check the username and Password properties of the NC object in the main function, they are saturated with the correct values.
However, if i dont call the external function that goes to the registry, and C&P it's code into the main function (ie. No need to pass the NC object byref!) and use the NC object on the Proxy, it runs the call perfectly well with no annoying 401's!!
eg.
'get login credentials for the webservice
objBroker = New DatabrokerServices.DatabrokerService 'the web service proxy
objUtil.GetServiceURL(mstrSERVICE_DATABROKER, strURL)
objBroker.Url = strURL
objCred = New System.Net.NetworkCredential
blnReturn = objUtil.GetServiceCredentials(mstrSERVICE_DATABROKER, objCred)
objBroker.Credentials = objCred.GetCredential(New Uri(strURL), "Negotiate")
strResponseEnc = objBroker.Execute(strCommandEnc) ' Fails with a 401, uid / pwd properties have correct values
********
whereas, this code works fine ... and yet it's looking at the same registry settings!?
objCred = New System.Net.NetworkCredential
objCred.Username = objUtil.GetServiceUID(mstrSERVICE_DATABROKER)
objCred.Password = objUtil.GetServicePWD(mstrSERVICE_DATABROKER)
objBroker.Credentials = objCred.GetCredential(New Uri(strURL), "Negotiate")
strResponseEnc = objBroker.Execute(strCommandEnc)
**************************************
Explanations anyone??
Cheers
Mark