network (drive) access/impersonate identity problem  
Author Message
Peter O'Reilly





PostPosted: 2003-11-3 23:47:38 Top

dotnet-framework-aspnet, network (drive) access/impersonate identity problem I am experiencing difficulty access a mapped network drive in an ASP.NET
application.

While using the .Net framework v 1.1 implementation of
System.IO.Directory.Exists(), it fails to recognize a mapped network drive.

This is true if the path specified uses a mapped drive letter or is
expressed as a UNC address. I have also tried the drive letter and UNC
paths with and without trailing backslashes, respectively.

No luck with ASP.NET, but it does work when I create a simple C# console
test harness application. This indicates to me to be a security concern with
ASP.NET. Funny thing is - no exception is returned. For all combinations,
System.IO.Directory.Exists returns false. (If so, this behavior is very
inconsistent with the System.Security thrown for things like trying to write
to a file, execute code on another machine, etc.)

The following knowledge base article:
307901: INFO: Permissions to Connect to a Remote Access Database from
ASP.NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;307901&Product=aspnet

recommends using impersonation, but an error occurs even before the 1st line
of my ASP.NET code is executed.
No windows event is logged either.

How do I get the ASP.NET worker process to recognize another machine's hard
drive, folders and files?

Any help is appreciated. Thanks!

--
Peter O'Reilly


 
bruce barker





PostPosted: 2003-11-4 3:29:00 Top

dotnet-framework-aspnet >> network (drive) access/impersonate identity problem you can not check for the existance of a file you do not have access
permission to, false is always returned, if an error was thown, you would
know that the file exists.

to access a network share from asp.net, you need to run under a domain
enabled primary secuirty token, the easiest way to do this is to use
impersonation in your web config as the article explained

<identity impersonate="true" userName="<supplied username>"
password="<supplied password>" />

where the user name is a domain account with permission to the resouce. all
users of your web site will have the same access permissions to the network
resource.

-- bruce (sqlwork.com)

"Peter O'Reilly" <email***@***.com!N!O!.S!P!AM!> wrote in message
news:email***@***.com...
> I am experiencing difficulty access a mapped network drive in an ASP.NET
> application.
>
> While using the .Net framework v 1.1 implementation of
> System.IO.Directory.Exists(), it fails to recognize a mapped network
drive.
>
> This is true if the path specified uses a mapped drive letter or is
> expressed as a UNC address. I have also tried the drive letter and UNC
> paths with and without trailing backslashes, respectively.
>
> No luck with ASP.NET, but it does work when I create a simple C# console
> test harness application. This indicates to me to be a security concern
with
> ASP.NET. Funny thing is - no exception is returned. For all
combinations,
> System.IO.Directory.Exists returns false. (If so, this behavior is very
> inconsistent with the System.Security thrown for things like trying to
write
> to a file, execute code on another machine, etc.)
>
> The following knowledge base article:
> 307901: INFO: Permissions to Connect to a Remote Access Database from
> ASP.NET
>
http://support.microsoft.com/default.aspx?scid=kb;en-us;307901&Product=aspne
t
>
> recommends using impersonation, but an error occurs even before the 1st
line
> of my ASP.NET code is executed.
> No windows event is logged either.
>
> How do I get the ASP.NET worker process to recognize another machine's
hard
> drive, folders and files?
>
> Any help is appreciated. Thanks!
>
> --
> Peter O'Reilly
>
>