Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > FileSystemObject Errors

Reply
Thread Tools

FileSystemObject Errors

 
 
Tony
Guest
Posts: n/a
 
      11-03-2005
I am trying (unsuccessfully) to open a file using fso.OpenTextFile. I have
given Full Trust to the assembly in Code Groups and Assembly Trust. I have
added IUSR and IWAM as users. I have checked and double checked every
permission available. I continue to get a Security Exception error off of
this code:


Dim epth As String = Server.MapPath("/error/errlog.log")
Dim fso As New Scripting.FileSystemObject

fso = Server.CreateObject("Scripting.FileSystemObject")
f = fso.OpenTextFile(epth, IOMode.ForAppending, True)
f.WriteLine("[" & DateString & "][" & TimeString & "] Module
'hs.aspx:age_Load::General', " & "Error " & Err.Number & ": " &
Err.Description)
f.Close()
Server.Transfer("/hsp/error/100.htm")

The error I get is this:

System.Security.SecurityException: Exception from HRESULT: 0x800A0046
(CTL_E_PERMISSIONDENIED).
 
Reply With Quote
 
 
 
 
Ken Schaefer
Guest
Posts: n/a
 
      11-04-2005
Are you running on Windows 2000/XP or Windows 2003 Server

By defaut, on Windows 2000/XP, ASP.NET pages run in the aspnet_wp.exe
process, and the process identity for tha process is Machine\ASPNET

On Windows 2003 Server, ASP.NET pages run in w3wp.exe process, and the
default process identity is NT Authority\Network Service.

You will need to give the appropriate account read/write NTFS permissions to
that file.

If you are using other accounts, or are impersonating, then please provide
details of your current configuration in that respect.

A troubleshooting tool you can use is Filemon from www.sysinternals.com,
which will tell you what account is being denied access to what.

Cheers
Ken

"Tony" <> wrote in message
news:3EDC0B2C-8A7E-46A3-A7E5-...
:I am trying (unsuccessfully) to open a file using fso.OpenTextFile. I have
: given Full Trust to the assembly in Code Groups and Assembly Trust. I have
: added IUSR and IWAM as users. I have checked and double checked every
: permission available. I continue to get a Security Exception error off of
: this code:
:
:
: Dim epth As String = Server.MapPath("/error/errlog.log")
: Dim fso As New Scripting.FileSystemObject
:
: fso = Server.CreateObject("Scripting.FileSystemObject")
: f = fso.OpenTextFile(epth, IOMode.ForAppending, True)
: f.WriteLine("[" & DateString & "][" & TimeString & "] Module
: 'hs.aspx:age_Load::General', " & "Error " & Err.Number & ": " &
: Err.Description)
: f.Close()
: Server.Transfer("/hsp/error/100.htm")
:
: The error I get is this:
:
: System.Security.SecurityException: Exception from HRESULT: 0x800A0046
: (CTL_E_PERMISSIONDENIED).


 
Reply With Quote
 
 
 
 
jeremi.rowland@wastewater.com
Guest
Posts: n/a
 
      12-01-2005
I am actually having a very similiar issue:
Any thoughts would be helpful:

Here's the scenerio:

HAD: Entire Windows 2000 domain multiple servers
Internal Web Server - Windows 2000
NAS Server - Windows 2000

Internal Web Application (On Web server) utilizing ASP scripts to
access shared directories through mapped drives on NAS Server. (And
yes, I know UNC paths should have been used, but I didn't actually
write this, just trying to follow someone else)

UPGRADED: All servers (including Web Server) except NAS Server to
Windows 2003 Server.
NAS Server remained on W2K Server.

PROBLEM: For some reason when ASP scripts are ran on the web server
(2003) they cannot access data on the NAS server (2000). However, they
have no problem accessing local data. ;-/

What special permissions have to be setup on either the 2003 and/or
2000 server to allow access to shared directories via an ASP script.

I'm at the end of my rope on this one, I have researched IIS 5.0 Worker
Process Isolation Mode, which we were in, and I have tried to switch
out of and still no luck. I have checked and re-checked all the NTFS
permissions on the NAS server shared directory and everything that I
believe is supposed to be there is allowed modify access.


OTHER NOTE: It looks like most of the scripts are utilizing one of our
"IUSR_" accounts in the directory security within IIS 6.0 and I have
double-checked the password is correct and that this user is a member
of the IIS_WPG group who incidentally also has NTFS permissions to this
share.

Here is an exact example:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<%
Set
fso=Server.CreateObject("Scripting.FileSystemObjec t")
if fso.fileExists("C:\rt.txt") then
CFile = "C:\rt.txt file found"
else
CFile = "C:\rt.txt file not found"
end if


if fso.fileExists("E:\rt.txt") then
EFile = "E:\rt.txt file found"
else
EFile = "E:\rt.txt file not found"
end if


if fso.fileExists("D:\rt.txt") then
DFile = "D:\rt.txt file found"
else
DFile = "D:\rt.txt file not found"
end if
Set fso = nothing
%>
This is to verify whether the file can be found on the particluar
drive<br><%=CFile%><br><%=DFile%><br><%=EFile%>
</body>
</html>


C & E are local drives where this rt.txt file is located and the
scripti finds them fine.
D is a mapped network drive on a windows 2000 server and even though
the file is there, the script displays the "File Not Found" message
indicating to me that it must not have permission or something.

 
Reply With Quote
 
JR
Guest
Posts: n/a
 
      12-01-2005
I am actually having a very similiar issue:
Any thoughts would be helpful:

Here's the scenerio:

HAD: Entire Windows 2000 domain multiple servers
Internal Web Server - Windows 2000
NAS Server - Windows 2000

Internal Web Application (On Web server) utilizing ASP scripts to
access shared directories through mapped drives on NAS Server. (And
yes, I know UNC paths should have been used, but I didn't actually
write this, just trying to follow someone else)

UPGRADED: All servers (including Web Server) except NAS Server to
Windows 2003 Server.
NAS Server remained on W2K Server.

PROBLEM: For some reason when ASP scripts are ran on the web server
(2003) they cannot access data on the NAS server (2000). However, they
have no problem accessing local data. ;-/

What special permissions have to be setup on either the 2003 and/or
2000 server to allow access to shared directories via an ASP script.

I'm at the end of my rope on this one, I have researched IIS 5.0 Worker
Process Isolation Mode, which we were in, and I have tried to switch
out of and still no luck. I have checked and re-checked all the NTFS
permissions on the NAS server shared directory and everything that I
believe is supposed to be there is allowed modify access.


OTHER NOTE: It looks like most of the scripts are utilizing one of our
"IUSR_" accounts in the directory security within IIS 6.0 and I have
double-checked the password is correct and that this user is a member
of the IIS_WPG group who incidentally also has NTFS permissions to this
share.

Here is an exact example:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<%
Set
fso=Server.CreateObject("Scripting.FileSystemObjec t")
if fso.fileExists("C:\rt.txt") then
CFile = "C:\rt.txt file found"
else
CFile = "C:\rt.txt file not found"
end if


if fso.fileExists("E:\rt.txt") then
EFile = "E:\rt.txt file found"
else
EFile = "E:\rt.txt file not found"
end if


if fso.fileExists("D:\rt.txt") then
DFile = "D:\rt.txt file found"
else
DFile = "D:\rt.txt file not found"
end if
Set fso = nothing
%>
This is to verify whether the file can be found on the particluar
drive<br><%=CFile%><br><%=DFile%><br><%=EFile%>
</body>
</html>


C & E are local drives where this rt.txt file is located and the
scripti finds them fine.
D is a mapped network drive on a windows 2000 server and even though
the file is there, the script displays the "File Not Found" message
indicating to me that it must not have permission or something.

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
FileSystemObject Errors =?Utf-8?B?VG9ueQ==?= ASP .Net 4 11-04-2005 11:37 AM
Script w/ FileSystemObject, error creating object =?Utf-8?B?a2VybWl0?= ASP .Net 8 04-24-2005 12:47 PM
FileSystemObject Question =?Utf-8?B?UGF0cmljay5PLklnZQ==?= ASP .Net 4 11-22-2004 03:35 AM
Errors, errors, errors Mark Goldin ASP .Net 2 01-17-2004 08:05 PM
IIS 5.0 / Win2k Hangs up when Reading file using Server.FileSystemObject Pedro Bautista ASP .Net 0 08-28-2003 11:56 PM



Advertisments
 



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 47 48 49 50 51 52 53 54 55 56 57