How to use WindowsPrincipal properly??
From: Kevin Yu (kyu@nrcan.gc.ca)
Date: 10/29/02
- Next message: Alex: "Error when trying to test a WebService"
- Previous message: Michael: "Access is denied when calling DirectoryEntry"
- Next in thread: Ed leNoir: "Re: How to use WindowsPrincipal properly??"
- Reply: Ed leNoir: "Re: How to use WindowsPrincipal properly??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Kevin Yu" <kyu@nrcan.gc.ca> Date: Tue, 29 Oct 2002 10:17:44 -0700
I am working on this intranet app here need proper authentication for users
and redirect them according
to their roles. I set app on IIS to use windows integrated authentication
and in my code, I check when user
login and get their identity, now I run into some minor problem, seems like
the following statement return
different result:
user.IsInRole(WindowsBuiltInRole.Administrator) this return false
and this
user.IsInRole("BUILTIN\Administrators") this return true
for the same user? what is the difference?
another question is how can I make sure user enter a proper domain in the
popup login?
say if the user dont enter the domain/computername that supposed to
authenticate him/her,
then I need to check domain in my code as well? since the
user.Indentity.Name will return
DOMAIN\username, then in code need to parse the domain and username and
validate both
of them, I saw some other code that use Impersonation as the following:
<DllImport("C:\\WINNT\\System32\\advapi32.dll")> _
Public Shared Function LogonUser(lpszUsername As String, lpszDomain As
String, lpszPassword As String, _
dwLogonType As Integer, dwLogonProvider As Integer, ByRef
phToken As Integer) As Boolean
End Function
seems like with Impersonation, there are lots more code needed. can anyone
clarify what the differences are between
the two?
thanks
- Next message: Alex: "Error when trying to test a WebService"
- Previous message: Michael: "Access is denied when calling DirectoryEntry"
- Next in thread: Ed leNoir: "Re: How to use WindowsPrincipal properly??"
- Reply: Ed leNoir: "Re: How to use WindowsPrincipal properly??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|