FileSystemObject Errors

G

Guest

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::page_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).
 
K

Kevin Spencer

System.Newsgroups.InvalidNewsgroupException: Invalid newsgroup. Please use
microsoft.public.inetserver.asp.general for ASP questions. Exception from
microsoft.public.dotnet.framework.aspnet newsgroup.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
P

Patrick.O.Ige

hahaha Kevin:)
Patrick

Kevin Spencer said:
System.Newsgroups.InvalidNewsgroupException: Invalid newsgroup. Please use
microsoft.public.inetserver.asp.general for ASP questions. Exception from
microsoft.public.dotnet.framework.aspnet newsgroup.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
A watched clock never boils.

Tony said:
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::page_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).
 
G

Guest

That's cute. However, I was writing this in ASP.NET so it is, in fact, the
correct newsgroup which makes you a false unhandled exception. Don't worry
though smart guy. I figured it out. Next time, if you don't have anything
useful to say, sit on your hands to keep them off of the keyboard.

Kevin Spencer said:
System.Newsgroups.InvalidNewsgroupException: Invalid newsgroup. Please use
microsoft.public.inetserver.asp.general for ASP questions. Exception from
microsoft.public.dotnet.framework.aspnet newsgroup.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

Tony said:
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::page_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).
 
K

Kevin Spencer

Well, I assumed it was ASP, since you were using the
Scripting.FileSystemObject instead of the .Net System.IO classes. In
addition, the code was indistinguishable from VBScript. I lloked it over.

Here's something useful: Avoid using COM, especially when there are much
better .Net classes in the CLR that can do even more than the COM classes
you are attempting to use. And here's a useful link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemio.asp

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

Tony said:
That's cute. However, I was writing this in ASP.NET so it is, in fact, the
correct newsgroup which makes you a false unhandled exception. Don't worry
though smart guy. I figured it out. Next time, if you don't have anything
useful to say, sit on your hands to keep them off of the keyboard.

Kevin Spencer said:
System.Newsgroups.InvalidNewsgroupException: Invalid newsgroup. Please
use
microsoft.public.inetserver.asp.general for ASP questions. Exception from
microsoft.public.dotnet.framework.aspnet newsgroup.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

Tony said:
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::page_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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top