Re: Impersonation and UnauthorizedAccessException
- From: "Chris Taylor" <chris_taylor_za@xxxxxxxxxxx>
- Date: Mon, 16 Oct 2006 22:32:19 +0300
Is the w drive a local drive or is it a mapped network drive?
--
Chris Taylor
http://dotnetjunkies.com/weblog/chris.taylor
<kevingeist@xxxxxxxxxxx> wrote in message
news:1161026330.077301.80920@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I hope someone can help me with this. Please tell me what I'm not
seeing. In my web app, I'm trying to create files to a common
directory. Only some network IDs have access to write to this
directory.
In my web.config I have:
<authentication mode="Windows"/>
<identity impersonate="true"/>
in my default.aspx.vb I have:
Dim impersonationContext As
System.Security.Principal.WindowsImpersonationContext
Dim currentWindowsIdentity As
System.Security.Principal.WindowsIdentity
....
currentWindowsIdentity = CType(User.Identity,
System.Security.Principal.WindowsIdentity)
impersonationContext = currentWindowsIdentity.Impersonate()
filePath = System.IO.Path.Combine("w:\kbg\", FileName)
My.Computer.FileSystem.WriteAllText(filePath, strData, False)
impersonationContext.Undo()
When I run the app on the localhost it works great. If I comment out
the impersonationContext line, the app fail because the ASPNET account
does not have access to write to the directory. When I uncomment it,
it works, my network account does have access rights. That's what I
want. My network account has access to the directory, I don't want
ASPNET to have access to it.
Next step, I bring up a browser session on another PC and run the app
on my development PC, I get an "Enter Network Password" popup. I enter
my network password, after a few tries I get an
"UnauthorizedAccessException: Access is to the path 'w:\KBG' is
denied." message. Why does it not work if initiated from another PC?
How do I fix it?
Any help would really be appreciated.
.
- Follow-Ups:
- Re: Impersonation and UnauthorizedAccessException
- From: kevingeist
- Re: Impersonation and UnauthorizedAccessException
- References:
- Impersonation and UnauthorizedAccessException
- From: kevingeist
- Impersonation and UnauthorizedAccessException
- Prev by Date: Re: AD Group Memberships (MyADMembershipProvider) Question
- Next by Date: Re: Impersonation and UnauthorizedAccessException
- Previous by thread: Impersonation and UnauthorizedAccessException
- Next by thread: Re: Impersonation and UnauthorizedAccessException
- Index(es):
Relevant Pages
|
|