NameTranslate in VB.NET - security context error

NameTranslate in VB.NET - security context error

Post by Jo » Sat, 25 Jan 2003 08:14:10



Hi,

I'm writing a webservice in VB.NET that is to return a
list of users in the specified NTGroup in Active
Directory. I'm using NameTranslate to get the LDAP binding
string in the following way:

Dim oTrans As New NameTranslate()
Dim sNetBIOSDomain As String = "cardcall.com.au"
Dim sNTName As String = "Accounts"
oTrans.Init(1, sNetBIOSDomain)
oTrans.Set(3, sNetBIOSDomain & "\" & sNTName)
Dim sDN As String = oTrans.Get(1)
Dim oUser As Object = GetObject("LDAP://" & sDN)

and when I get to the oTrans.Init command I get the
following error:

System.Runtime.InteropServices.COMException (0x80090332):
The security context could not be established due to a
failure in the requested quality of service (e.g. mutual
authentication or delegation).

Can anyone help?

Thanks in advance,

Jo

 
 
 

NameTranslate in VB.NET - security context error

Post by Richard Muelle » Sat, 25 Jan 2003 09:16:41


Hi,

sNetBIOSDomain will not be in the form "cardcall.com.au".
It should be something like "cardcall". It is the string
returned by WshNetwork.UserDomain.

Richard

Quote:>-----Original Message-----
>Hi,

>I'm writing a webservice in VB.NET that is to return a
>list of users in the specified NTGroup in Active
>Directory. I'm using NameTranslate to get the LDAP
binding
>string in the following way:

>Dim oTrans As New NameTranslate()
>Dim sNetBIOSDomain As String = "cardcall.com.au"
>Dim sNTName As String = "Accounts"
>oTrans.Init(1, sNetBIOSDomain)
>oTrans.Set(3, sNetBIOSDomain & "\" & sNTName)
>Dim sDN As String = oTrans.Get(1)
>Dim oUser As Object = GetObject("LDAP://" & sDN)

>and when I get to the oTrans.Init command I get the
>following error:

>System.Runtime.InteropServices.COMException (0x80090332):
>The security context could not be established due to a
>failure in the requested quality of service (e.g. mutual
>authentication or delegation).

>Can anyone help?

>Thanks in advance,

>Jo
>.


 
 
 

NameTranslate in VB.NET - security context error

Post by Joe Kapla » Sat, 25 Jan 2003 10:12:20


You may not be able to use GetObject in ASP.NET because the ASPNET worker
process by default runs in a local user account called ASPNET.

The first thing I would suggest is that you try using OpenDsObject and pass
in credentials to see if that works.

I would also suggest that you try using System.DirectoryServices to do this
stuff.  While it doesn't have a Name Translate object, it isn't a big deal
to do a search on the domain using the DirectorySearcher object searching on
samAccountName.  The filter would just be:
(&(objectCategory=person)(objectClass=user)(samAccountName=yourvaluehere))

Have the searcher load distinguishedName and you should be in business.
Also, you will want to pass in credentials to the DirectoryEntry you use as
your searchRoot object for the DirectorySearcher.

Good luck,

Joe K.


Quote:> Hi,

> I'm writing a webservice in VB.NET that is to return a
> list of users in the specified NTGroup in Active
> Directory. I'm using NameTranslate to get the LDAP binding
> string in the following way:

> Dim oTrans As New NameTranslate()
> Dim sNetBIOSDomain As String = "cardcall.com.au"
> Dim sNTName As String = "Accounts"
> oTrans.Init(1, sNetBIOSDomain)
> oTrans.Set(3, sNetBIOSDomain & "\" & sNTName)
> Dim sDN As String = oTrans.Get(1)
> Dim oUser As Object = GetObject("LDAP://" & sDN)

> and when I get to the oTrans.Init command I get the
> following error:

> System.Runtime.InteropServices.COMException (0x80090332):
> The security context could not be established due to a
> failure in the requested quality of service (e.g. mutual
> authentication or delegation).

> Can anyone help?

> Thanks in advance,

> Jo

 
 
 

1. set password using asp.net w/ vb.net?

Hi,

I am trying to change a user's password using asp.net w/ vb.net.

The vb.net code is as follows:

Public Sub SubmitBtn_Click(ByVal Sender As Object, ByVal E As EventArgs)

Dim user As DirectoryEntry
user = New DirectoryEntry("Winnt://" & domain.Text & "/" & Account.Text &
",User")
user.Invoke("setPassword", password.Text)
user.CommitChanges()
End Sub

I recieve the following error message:

Unknown error (0x80005000)
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Unknown
error (0x80005000)

Source Error:

Line 40:         Dim user As DirectoryEntry
Line 41:         user = New DirectoryEntry("Winnt://" & domain.Text & "/" &
Account.Text & ",User")
Line 42:         user.Invoke("setPassword", password.Text)
Line 43:         user.CommitChanges()
Line 44:

Source File: c:\inetpub\wwwroot\passwordchange\changepassword.aspx.vb
Line: 42

Stack Trace:

[COMException (0x80005000): Unknown error (0x80005000)]
   System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   System.DirectoryServices.DirectoryEntry.Bind()
   System.DirectoryServices.DirectoryEntry.get_NativeObject()
   System.DirectoryServices.DirectoryEntry.Invoke(String methodName,
Object[] args)
   passwordchange.changepassword.SubmitBtn_Click(Object Sender, EventArgs E)
in c:\inetpub\wwwroot\passwordchange\changepassword.aspx.vb:42
   System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   System.Web.UI.Page.ProcessRequestMain() +1263

2. remote administration

3. How do I use paging in VB.NET & ADO.NET using OLEDB Provider ADsDSOObject

4. Mercury 35MHz '040 problems

5. Using VB GetObject using a specified security context?

6. PB & mail, mailRecipient Structure question

7. VB.net Error Updating property that was previously Null

8. Outage reporting tools??

9. Error Calling ADSystemInfo methods from VB.NET

10. bind to object using adsi and asp.net/vb.net errors?

11. ERROR: The security context could not be established

12. Is there a Web Part Step-by-Step for VB.NET?

13. Problems setting categories in PKMCDO.KnowledgeDocument with VB.NET