Subject: RE: impersonating and LogonUser
Date: Tue, 30 Dec 2003 13:01:06 -0800
Lines: 97
Message-ID: <
[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcPPGArOEJZUmCWqTvWaK6UCxhVpMw==
Newsgroups: microsoft.public.dotnet.framework.aspnet
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:198969
NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Maybe I'm missing something with my understanding of
impersonation.
I thought impersonation either ran as the user specified
in the web.config or as the account configured in IIS or
as the windows identity user if windows authentication is
selected.
I have to use forms authentication but I validate the user
logging on against active directory. I retrieve their
username and password from a login screen.
Is it possible to have the application run as the user
once they have been verified using forms authentication?
-----Original Message-----
Jason,
Do you need to impersonate a specific user just during
the execution of a
particular code block? If not and you really just need
to ensure that the
app runs under the context of the currently logged on
user, you simply need
to deny access to unauthenticated users via the
web.config and enable
impersonation.
Jim Cheshire [MSFT]
Microsoft Developer Support
ASP.NET
(e-mail address removed)
This post is provided as-is with no warranties and
confers no rights.
--------------------
I actually do that. The problem is that I need to
perform
operations on the Active Directory as the logged on
user.
Which means I need to either pass the logged on user
name
and password to the DirectoryEntry object or
impersonate -
that way, if the logged on user does not have the right,
the operation fails.
Unless there is another way?
-----Original Message-----
Jason,
I'm not really sure how long that token persists.
However, I certainly
wouldn't implement your functionality in this way.
Instead, why not just
use Forms Authentication and authenticate against
Active
Directory?
Jim Cheshire, MCSE, MCSD [MSFT]
Microsoft Product Support Services
ASP.NET Developer Support
This post is provided "as-is" and confers no rights.
--------------------
I have an ASP.NET application with forms
authentication.
However, the login details correspond to a Windows
account
(I cannot use Windows authentication). If I obtain a
token
with LogonUser, can I store it in a session variable
and
perform an impersonation on each page load? How long
is
that token valid? If I do an impersonation on each
page
load but never an Undo, will it cause problems?
I think that once the response finishes, the
impersonation
finishes. When the response re-starts i.e. page is
loaded,
the impersonation can be manually restarted without
problems. I'm not sure about the lifetime of the token.
.
.