This has problaby been address, but I can't seem to resolved this problem. All I'm trying to do is do a directory listing of a UNC share from a web page. The following is the code. Dim di As New DirectoryInfo("\\server\share") Dim fi As FileInfo() = di.GetFiles()
Response.Write("
") Response.Write("The following files exist in the current directory:
") Dim fiTemp As FileInfo For Each fiTemp In fi Response.Write(fiTemp.Name + "
") Next fiTemp I have IIS 5.0 server with only Integrated Windows Authentication on. I inserted the Impersonation=true in the web.config file. Authentication mode is set to "Windows" only. The share has the requested groups assigned with read/change access.
The webserver is in the same domain as the server hosting the share. The account that I was testing was also a domain admin account and has local admin privileges on both servers. Is there something I'm missing??? Thanks in advance!
MeetyCheesy
It is easy to ask for forgiveness then to ask for permission. {unknown}
Likely the problem is in the policy of the code because the application is not trusted to do File IO operations over the network. I didn't check this myself yet (sorry) but take a look at the .NET Framework Configuration (Start, Programs, Administrative Tools)
and grant your assembly "full trust" just to see whether this is the problem. The best way to do it is by trusting the "publisher" of the assembly but to do this, you'll have to take a look at the documentation on this. All this stuff has to do with the "secure
by default" approach in the .NET Framework and should be regarded as a strong advantage rather than a difficult step in the deployment phase of the application (although it can be a nasty task to get it completely right, I've heard complaints about this already).
Furthermore, can't you get some more information of the exception thrown? Another tip to see whether it has nothing to do with the ACLs on the resource itself: show the User.Identity.Name on your webpage to make sure it's running in the right security context!
Maybe it's the best solution to do this first before taking a look at the CAS (code-access security) since I'm not 100% sure CAS will play a role in this problem (I'm not on my development box now so I can't check it right away).
I will check on the .NET Framework options and check. On the user.identity.name, it is impersonating correcting and displaying the correct user. Here is the exception that is thrown. System.UnauthorizedAccessException: Access to the path "\\ssf3007\testsoftware"
is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.Directory.InternalGetFileDirectoryNames(String fullPath, String userPath, Boolean file) at System.IO.Directory.InternalGetFiles(String path, String userPath, String searchPattern)
at System.IO.DirectoryInfo.GetFiles(String searchPattern) at System.IO.DirectoryInfo.GetFiles() at WebApplication2.test.lbtnTEST_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebApplication2\test.aspx.vb:line 47 This leads me to believe its an ACL
issue, but what the heck. Let me check your first option first and I'll post my results. Thanks for the help!
MeetyCheesy
It is easy to ask for forgiveness then to ask for permission. {unknown}
strinh
Member
40 Points
8 Posts
[UnauthorizedAccessException: Access to the path "\\server\share" is denied.
Jul 09, 2004 10:13 PM|LINK
") Response.Write("The following files exist in the current directory:
") Dim fiTemp As FileInfo For Each fiTemp In fi Response.Write(fiTemp.Name + "
") Next fiTemp I have IIS 5.0 server with only Integrated Windows Authentication on. I inserted the Impersonation=true in the web.config file. Authentication mode is set to "Windows" only. The share has the requested groups assigned with read/change access. The webserver is in the same domain as the server hosting the share. The account that I was testing was also a domain admin account and has local admin privileges on both servers. Is there something I'm missing??? Thanks in advance!
It is easy to ask for forgiveness then to ask for permission. {unknown}
TGIF!! Happy Friday!
bdesmet
Star
8255 Points
1651 Posts
Re: [UnauthorizedAccessException: Access to the path "\\server\share" is denied.
Jul 10, 2004 11:33 PM|LINK
Visit www.msdn.be, www.bartdesmet.net
strinh
Member
40 Points
8 Posts
Re: [UnauthorizedAccessException: Access to the path "\\server\share" is denied.
Jul 12, 2004 10:30 PM|LINK
It is easy to ask for forgiveness then to ask for permission. {unknown}
TGIF!! Happy Friday!
strinh
Member
40 Points
8 Posts
Re: [UnauthorizedAccessException: Access to the path "\\server\share" is denied.
Jul 12, 2004 10:35 PM|LINK
It is easy to ask for forgiveness then to ask for permission. {unknown}
TGIF!! Happy Friday!