Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Access to the path .... is denied

 
Thread Tools Search this Thread
Old 05-10-2006, 06:04 PM   #1
Default Access to the path .... is denied


Hi there,

There was older thead i created for that question a week ago, but then
I had some sort of vacations, and couldn't participate.
Basically I am getting Access to the path "Path name" is denied when I
execute the following code on my production server (W2003)

Dim myFolder As String = Server.MapPath("..\..\..\sDirectory\")
Dim FileName As String

For Each FileName In Directory.GetFiles(myFolder , "*.doc")
Response.Write(FileName)
Exit For
Next

This code will run just fine on my testing machine (Windows XP)

sDirectory is a virtual directory.
Anonymous is turned off.
DIgest authentication for Windows domain servers is selected.
Basic authentication is selected.
..Net Password authentication is not selected.
Permissions on the file:
Administrator (Domain\Administrator)
aspnet_wp account (computerName\ASPNET)
Authenticated Users
Everyone
I don't use identity impersonate in my web.config.


I found many discussions regarding that problem, unfortunatelly still
cannot resolve it by myself...



j_stus@hotmail.com
  Reply With Quote
Old 05-10-2006, 06:51 PM   #2
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
 
Posts: n/a
Default RE: Access to the path .... is denied
I know this sounds hokey, but have you looked at the populated myFolder
string variable to see what the translated path actually is, and whether it
is valid? You could do a Trace write of this and turn on page tracing
temporarily to see it.

Otherwise, the identity your app runs under (whether the ASPNET account IUSR
or however else it's configured) needs to have the required permissions on
this folder on the target machine.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"" wrote:

> Hi there,
>
> There was older thead i created for that question a week ago, but then
> I had some sort of vacations, and couldn't participate.
> Basically I am getting Access to the path "Path name" is denied when I
> execute the following code on my production server (W2003)
>
> Dim myFolder As String = Server.MapPath("..\..\..\sDirectory\")
> Dim FileName As String
>
> For Each FileName In Directory.GetFiles(myFolder , "*.doc")
> Response.Write(FileName)
> Exit For
> Next
>
> This code will run just fine on my testing machine (Windows XP)
>
> sDirectory is a virtual directory.
> Anonymous is turned off.
> DIgest authentication for Windows domain servers is selected.
> Basic authentication is selected.
> ..Net Password authentication is not selected.
> Permissions on the file:
> Administrator (Domain\Administrator)
> aspnet_wp account (computerName\ASPNET)
> Authenticated Users
> Everyone
> I don't use identity impersonate in my web.config.
>
>
> I found many discussions regarding that problem, unfortunatelly still
> cannot resolve it by myself...
>
>



=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
  Reply With Quote
Old 05-10-2006, 07:04 PM   #3
Juan T. Llibre
 
Posts: n/a
Default Re: Access to the path .... is denied
re:
> Dim myFolder As String = Server.MapPath("..\..\..\sDirectory\")
> sDirectory is a virtual directory.


Do you have AspEnableParentPaths set to true ?
To increase security, parent paths are disabled by default.

http://msdn.microsoft.com/library/de...1ed541e3a5.asp




Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<> wrote in message news: ps.com...
> Hi there,
>
> There was older thead i created for that question a week ago, but then
> I had some sort of vacations, and couldn't participate.
> Basically I am getting Access to the path "Path name" is denied when I
> execute the following code on my production server (W2003)
>
> Dim myFolder As String = Server.MapPath("..\..\..\sDirectory\")
> Dim FileName As String
>
> For Each FileName In Directory.GetFiles(myFolder , "*.doc")
> Response.Write(FileName)
> Exit For
> Next
>
> This code will run just fine on my testing machine (Windows XP)
>
> sDirectory is a virtual directory.
> Anonymous is turned off.
> DIgest authentication for Windows domain servers is selected.
> Basic authentication is selected.
> .Net Password authentication is not selected.
> Permissions on the file:
> Administrator (Domain\Administrator)
> aspnet_wp account (computerName\ASPNET)
> Authenticated Users
> Everyone
> I don't use identity impersonate in my web.config.
>
>
> I found many discussions regarding that problem, unfortunatelly still
> cannot resolve it by myself...
>





Juan T. Llibre
  Reply With Quote
Old 05-10-2006, 07:34 PM   #4
j_stus@hotmail.com
 
Posts: n/a
Default Re: Access to the path .... is denied
I actually print myFolder path, then copy and paste to explorer and can
access it...
AspEnableParentPaths was not set to true, I did that but it didn't fix
my problem.
My xp machine has this option disabled and still works...



j_stus@hotmail.com
  Reply With Quote
Old 05-10-2006, 08:09 PM   #5
j_stus@hotmail.com
 
Posts: n/a
Default Re: Access to the path .... is denied
I did one more test.
I created another virtual directory, that points to some folder on my
server (local)
Then used same code to access it and it worked.
Then I checked permissions on both folders under security tab, and they
seem to be similar. The only difference is local one has
localMachineName/ASPNET and network has anotherMachineName/ASPNET.



j_stus@hotmail.com
  Reply With Quote
Old 05-10-2006, 09:07 PM   #6
Juan T. Llibre
 
Posts: n/a
Default Re: Access to the path .... is denied
Please save the following code as "identity.aspx", and run it in the same directory
as the file which is giving you the "access denied..." error message :

identity.aspx
-------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
----------

When you run the file, make note of the account returned as the asp.net identity.
Then, give read/write/change permissions to *that* account for the "myFolder" directory.

Let us know what happens when you do that.





Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<> wrote in message news: oups.com...
>I actually print myFolder path, then copy and paste to explorer and can
> access it...
> AspEnableParentPaths was not set to true, I did that but it didn't fix
> my problem.
> My xp machine has this option disabled and still works...
>





Juan T. Llibre
  Reply With Quote
Old 05-10-2006, 09:52 PM   #7
j_stus@hotmail.com
 
Posts: n/a
Default Re: Access to the path .... is denied
WindowsIdentity.GetCurrent().Name will print NT AUTHORITY\NETWORK
SERVICE
User.Identity.Name will print myDomain/myUserName.

So I added read/write/change permissions to myDomain/myUserName -
didn't help.
Now, I don't have user called NT AUTHORITY\NETWORK SERVICE on my
domain, nor on the box that has the folder. Should I create one? On
domain?



j_stus@hotmail.com
  Reply With Quote
Old 05-10-2006, 10:25 PM   #8
MSDN
 
Posts: n/a
Default Re: Access to the path .... is denied
I beleive that NETWORK SERVICE account is created automatically if you are
on Win 2k3

SA

<> wrote in message
news: ups.com...
> WindowsIdentity.GetCurrent().Name will print NT AUTHORITY\NETWORK
> SERVICE
> User.Identity.Name will print myDomain/myUserName.
>
> So I added read/write/change permissions to myDomain/myUserName -
> didn't help.
> Now, I don't have user called NT AUTHORITY\NETWORK SERVICE on my
> domain, nor on the box that has the folder. Should I create one? On
> domain?
>





MSDN
  Reply With Quote
Old 05-10-2006, 11:56 PM   #9
Juan T. Llibre
 
Posts: n/a
Default Re: Access to the path .... is denied
re:
> Now, I don't have user called NT AUTHORITY\NETWORK SERVICE
> on my domain, nor on the box that has the folder. Should I create one?


NT AUTHORITY\NETWORK SERVICE is a local account, not a domain account.

Are you running your ASP.NET web server on a domain server ?





Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<> wrote in message news: ups.com...
> WindowsIdentity.GetCurrent().Name will print NT AUTHORITY\NETWORK
> SERVICE
> User.Identity.Name will print myDomain/myUserName.
>
> So I added read/write/change permissions to myDomain/myUserName -
> didn't help.
> Now, I don't have user called NT AUTHORITY\NETWORK SERVICE on my
> domain, nor on the box that has the folder. Should I create one? On
> domain?
>





Juan T. Llibre
  Reply With Quote
Old 05-11-2006, 02:23 PM   #10
j_stus@hotmail.com
 
Posts: n/a
Default Re: Access to the path .... is denied
I guess I was not clear enough.
ASP.NET is running on Windows2003 server. It's not domain controller.
I created virtual directory on that machine that points to network
directory.
It points to another computer on the network (W2000 server).
Because W2000 doesn't have NT AUTHORITY\NETWORK SERVICE I am not sure
how to resolve it...



j_stus@hotmail.com
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
server 2003 access denied errors lockeff6 General Help Related Topics 0 07-15-2009 03:12 PM
Access to the path ... is denied calvinkwoo3000 General Help Related Topics 1 11-05-2008 11:04 PM
Access Denied error while calling Windows service in web application megha Software 0 04-05-2008 10:03 AM
I cant access the MCP site T3M4N MCTS 1 03-18-2008 06:21 PM
access denied techboi General Help Related Topics 2 08-24-2007 12:56 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46