Re: Impersonation and UnauthorizedAccessException



You would need to have Kerberos delegation working in that scenario then
(assuming you are using integrated auth in IIS). Otherwise you have a
double hop issue when accessing with a browser from a remote machine.

You could try following the normal procedures to set up Kerberos delegation.
I'm not sure exactly how it work with mapped network drives and naming
conventions, but you should be able to get it working fine using the share
name.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
<kevingeist@xxxxxxxxxxx> wrote in message
news:1161028179.668132.221420@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
It is a mapped network drive.

Chris Taylor wrote:
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.




.



Relevant Pages

  • Re: ODBC Connection with SQL Managed Provider
    ... One thing to remember is when running application from a network share, ... > So it was our intent to put a lot of the "forms" into the main app. ... the odbc manager is no quicker than the odbc. ... >>> authorizing the user against a table in the SQL server database. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: .NET new executable
    ... Since there is no network access avaialble, I want to send my app to each ... then you update the data into database. ... If all you are trying to do is send some data to your SQL server, ...
    (microsoft.public.dotnet.general)
  • Re: LISP for web
    ... Any large scale web app that is business critical is based on a few ... -> So you need at least two routers, two switches, two machines ... ... Load balancing is done based on content and on network traffic ...
    (comp.lang.lisp)
  • Re: Environment.CommandLine Security Exception
    ... installed on network drives and they typically don't ... require that users get into the details of security as ... believe an MS Office network install is a good example of ... >app from a *network* share. ...
    (microsoft.public.dotnet.security)
  • Strange behavior on a Novell system
    ... Recently we instituted a security policy on our companies Novell ... network due to some users abusing the non-policy we had for 10 years. ... When I run the app from the command line (and I have full supervisor ... rights) the error happens every other time I start the app. ...
    (microsoft.public.fox.programmer.exchange)