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... 11 2495
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
"j_****@hotmail.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...
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/
===================================
<j_****@hotmail.com> wrote in message news:11********************@g10g2000cwb.googlegrou 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...
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...
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.
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/
===================================
<j_****@hotmail.com> wrote in message news:11**********************@y43g2000cwc.googlegr 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...
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?
I beleive that NETWORK SERVICE account is created automatically if you are
on Win 2k3
SA
<j_****@hotmail.com> wrote in message
news:11*********************@i40g2000cwc.googlegro 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?
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/
===================================
<j_****@hotmail.com> wrote in message news:11*********************@i40g2000cwc.googlegro 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?
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...
That's quite a bit clearer, thanks.
If both machines are in the same domain, you can use impersonation for ASP.NET.
Create a domain account and
1. have ASP.NET run as that account
2. give that account the permissions it needs to the W2000 server's folder
See http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx
for a list of ASP.NET 2.0 directories and the permissions the new ASP.NET account will require.
Review this checklist : http://msdn.microsoft.com/library/de...aght000009.asp
for instructions on how to run ASP.NET with a custom service account.
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/
===================================
<j_****@hotmail.com> wrote in message news:11**********************@j33g2000cwa.googlegr oups.com... 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...
First of all it is quite challanging, at least for me....
It helped but didn't resolve my problem.
I created domain user, because I don't have ASP.NET 2.0, i followed http://msdn.microsoft.com/library/de...SecNetht01.asp
those instructions to create a Custom Account to Run ASP.NET 1.1.
Then I modified web.config to
<identity impersonate="true" userName="DOMAIN\userName"
password="strongPass"></identity>
then I gave w2000 folder permissions to that accout.
Works!!!!!!
But, there is small problem.
I cannot modify web.config in my production web site.
So I think I should follow those steps:
Add domain user to connect to w2003 server. (HOW?)
Then create tokenHandle while calling LogonUser function
Then execute this code
Dim newId As New WindowsIdentity(tokenHandle)
Dim impersonatedUser As WindowsImpersonationContext =
newId.Impersonate()
Once executed, asp should run as that impersonated account.
Then I should be able to connect to w2000 server, do what I have to do,
then
impersonatedUser.Undo()
Does it make sense? Also how do I add domain user to w2003?
Thanks, This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Theerachet Pratoommanee |
last post by:
This is error message I've got. Any suggestion would be appreciated.
Server Error in '/WebDirectory' Application.
----------------------------------------------------------------------------...
|
by: Fabian von Romberg |
last post by:
Hi, I have installed Sql Reporting Services on 2 machines, one is WIN 2000
PRO and the other one is WIN 2000 ADV. SERVER. When I try to access a
report using the webbrowser, I get the following...
|
by: Goran |
last post by:
Hi
I have created a very simple ASP.Net application that only consists of
a CrystalReports Viewer, that has been connected to a .rpt file.
When the page is loaded in the browser, the following...
|
by: Shailesh Humbad |
last post by:
I figured out what was causing the "Access is Denied" error when
calling functions from referenced DLLs in my service. I've tried to
be very detailed, so bear with me.
It turns out that...
|
by: Duffman |
last post by:
Hi,
I have what seems to be a common problem, but the solutions I've found don't
seem to work. I would like to use a web service to create a file at a UNC
location in a shared file. Currently...
|
by: David Thielen |
last post by:
Hi;
I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But
when it tries to write a file I get:
Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images
...
|
by: stephen |
last post by:
Hi,
I am getting an Error "Access to the path...... is denied" Error. I have an
web app and I am creating a log file to write the error info. If I have the
absolute path...
|
by: cpajoe2001 |
last post by:
I am having an issue and after searching around online for a day and half now and finding others with the same problem but yet no solution to my issue I am looking for help.
What i have is ServerA...
|
by: Jeremy Ames |
last post by:
I am trying to move an application from my system to a new test system. I really should have tried an easier program first, but I didn't really have a chance. My application was originally written in...
|
by: p.thorn.ru |
last post by:
Hello,
I am running db2 express-c 9.5 under linux (fedora 7), and my error
log frequently shows messages like these:
2008-01-08-18.30.01.952964+180 I651334G1048 LEVEL: Error (OS)
PID ...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
| |