Re: System.UnauthorizedAccessException
From: Joyjit Mukherjee (joyjit_mukherjee_at_hotmail.com)
Date: 09/08/04
- Next message: George: "Re: DropDownList SelectedIndexChanged not firing for extra <form>"
- Previous message: CDARS: "Request Cookies right after they're being Set"
- In reply to: Peter Afonin: "System.UnauthorizedAccessException"
- Next in thread: Peter Afonin: "Re: System.UnauthorizedAccessException"
- Reply: Peter Afonin: "Re: System.UnauthorizedAccessException"
- Reply: Peter Afonin: "Re: System.UnauthorizedAccessException"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 8 Sep 2004 12:23:17 +0530
Hi,
you need to impersonate the user under whose behalf the resource is going to
be accessed. Put a <identity> tag in ur Web.Config as follows: -
< identity impersonate = "true" userName = "Domain\username" password =
"password" />
Regards
Joyjit
"Peter Afonin" <peter@gudzon.net> wrote in message
news:%23HW$lQTlEHA.3632@TK2MSFTNGP09.phx.gbl...
> Hello,
>
> I'm using this code to access a network share from an asp.net page:
>
> Dim dir As DirectoryInfo = New DirectoryInfo("\\10.0.0.150\FormLib\")
> Dim files() As FileInfo = dir.GetFiles("*.eps")
>
> When I try to do it, I get this error:
>
> System.UnauthorizedAccessException: Access to the path
> "\\10.0.0.150\FormLib\" 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
> Wip7b.WorkInProcess.btnGetEPS_ServerClick(Object sender, EventArgs e)
>
> All permissions to this folder and a file share are set to
Everyone.Usually
> I don't have this problem. The only thing that is different about this
> particular machine that it is not a part of the domain to which all other
> PCs in our company belong, so I cannot access any users from our Active
> Directory.
>
> This is a Win 2000 SP4 machine.
>
> I would greatly appreciate your help.
>
> Thank you,
>
> --
> Peter
>
>
- Next message: George: "Re: DropDownList SelectedIndexChanged not firing for extra <form>"
- Previous message: CDARS: "Request Cookies right after they're being Set"
- In reply to: Peter Afonin: "System.UnauthorizedAccessException"
- Next in thread: Peter Afonin: "Re: System.UnauthorizedAccessException"
- Reply: Peter Afonin: "Re: System.UnauthorizedAccessException"
- Reply: Peter Afonin: "Re: System.UnauthorizedAccessException"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|