Re: Access Network Shares from asp.net

From: Steve Caliendo (scaliendo_at_epion.com)
Date: 03/23/04


Date: Tue, 23 Mar 2004 14:23:25 -0500

I think you need to set up permsissions for the ASPNET user on the web
server. I don't know if this is acceptable in your application, but:

If you - when sitting at the web server PC - can access, say "Z:\" drive by
browsing, then what you want can be done by setting the User Permissions for
the ASPNET user to be identical for the current user of the web server PC.
I've set my ASPNET user to be an administrator, and my connection problems
went away. I'm sure that this is some kind of 'no-no', but I don't care.

Steve

"Raterus" <raterus@localhost> wrote in message
news:OhoL6uOEEHA.1368@TK2MSFTNGP11.phx.gbl...
> I'm getting a little overwhelmed with security with a problem I'm having.
> Basically I have a network share on a separate server than my web server
> that I need to access from an aspx page. This is an intranet application,
> and every user will be using IE. I've disabled anonymous access on IIS,
and
> I'm using Integrated Windows Authentication. Web.config authentication is
> set to "Windows".
>
> Here is where I'm getting confused, mostly with impersonation, I think I
> understand what it is, but I'm not sure I need to use it <identity
> impersonate="true"> in web.config.
>
> Here is what I'm after, a user accesses this webpage, I determine the
folder
> they need to get at, and send a DirectoryInfo object out to get a listing
of
> files off this network share. The share itself has full access for
"domain
> admins" and each user folder inherits that permission, and I've manually
set
> full access permissions for each user based on the folder.
>
> That's where my problem is, I get a "System.UnauthorizedAccessException"
> error, and I can't seem to figure out why! It seems like it should work,
> especially with impersonate="true" set.
>
> I ran this code and here is what I got (impersonate="false"):
> Response.Write("HttpContext: " & HttpContext.Current.User.Identity.Name &
> "<BR>")
> Response.Write("WindowsIdentity: " &
> System.Security.Principal.WindowsIdentity.GetCurrent.Name & "<br>")
> Response.Write("Thread: " &
> System.Threading.Thread.CurrentPrincipal.Identity.Name & "<br>")
>
> HttpContext: MYDOMAIN\Michael
> WindowsIdentity: NT AUTHORITY\NETWORK SERVICE
> Thread: MYDOMAIN\Michael
>
> The MYDOMAIN\Michael is my username, and that is what I want to be used
when
> determining directory access. I've tried to toggle <identity
> impersonate="true"> but I still get the error. They only way I've gotten
it
> to work is to have "everyone" permissions set with full access, not the
> solution I want!
>
> Can anyone offer any help?
> --Michael
>
>



Relevant Pages

  • RE: Windows 2003 Server - Everyone Group
    ... this folder only accessable by the users in the "special" group. ... Configure User and Group Access on an Intranet in Windows Server ... NTFS files system permissions control ... group that you want to set permissions for, click Check Names to verify the ...
    (microsoft.public.win2000.networking)
  • Re: Office Docs wont Open? and BU Drive not Recognized?
    ... Create a new Folder: ... On the server share... ... SHARING tab | Permissions | Share Permissions | Group or User Names ... If I copy the document to the local Client, the document opens ...
    (microsoft.public.windows.server.sbs)
  • Re: An NT Security Gotcha that looks like a Jet Security issue
    ... >people remotely via Windows Terminal Server. ... >code when it was run by a user that didn't have full permissions on ... There's a top-level DATA folder, ... >ApplicantsDB and Quickbooks. ...
    (comp.databases.ms-access)
  • Re: Exchange Move Issues?
    ... I'm a bit confused on what permissions to assign for SBS, ... When you finish moving the databases, ... You can move the log files and database files to any folder that you want to ... Note Only assign permissions to the Server Operators group if the Exchange ...
    (microsoft.public.windows.server.sbs)
  • Re: MS - Access Issues
    ... I don't see anything anywhere for NTFS folder permissions. ... Nor can it find the domain server. ... checked to bypass proxy server for local addresses. ...
    (microsoft.public.windows.server.sbs)