FileSystemObject Errors

  • Thread starter Thread starter Guest
  • Start date Start date
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).
 
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.
 
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).
 
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).
 
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).
 
Back
Top