CTL_E_PERMISSIONDENIED

CTL_E_PERMISSIONDENIED

am 05.04.2006 00:57:01 von Hans-Peter Sauer

IIS 6 on Win2003 with Net 2.0

I am getting an exception trying to run a simple aspx page. This is causing
the error: objCount = objFSO.CreateTextFile("counter.txt", True). I have
gone through my default web page settings and the ntfs setting for
counter.txt. Could someone please point me to the correct IIS server
configuration settings and ntfs setting so that I can run this page (and
many others). Thanks.


Server Error in '/' Application.
------------------------------------------------------------ --------------------

Security Exception
Description: The application attempted to perform an operation not allowed
by the security policy. To grant this application the required permission
please contact your system administrator or change the application's trust
level in the configuration file.

Exception Details: System.Security.SecurityException: Exception from
HRESULT: 0x800A0046 (CTL_E_PERMISSIONDENIED)


Source File: c:\inetpub\wwwroot\hitit.aspx Line: 27

Source Error:
Line 25: visitorcount = visitorcount + 1
Line 26: objCount.close
Line 27: objCount = objFSO.CreateTextFile("counter.txt", True)
Line 28: objCount.WriteLine(visitorcount)
Line 29: end if

Re: CTL_E_PERMISSIONDENIED

am 05.04.2006 08:13:22 von Ken Schaefer

Hi,

You probably need to change the trust level of your application to "Full"
trust, in order to use the FSO to write files.

This can be done in web.config.

It is not an IIS or NTFS setting, but a .NET Framework setting

Cheers
Ken

--
IIS Blog: http://www.adOpenStatic.com/cs/blogs/ken


"MikeV06" wrote in message
news:pfeyrkpfobov.dlg@mycomputer06.invalid.com...
: IIS 6 on Win2003 with Net 2.0
:
: I am getting an exception trying to run a simple aspx page. This is
causing
: the error: objCount = objFSO.CreateTextFile("counter.txt", True). I have
: gone through my default web page settings and the ntfs setting for
: counter.txt. Could someone please point me to the correct IIS server
: configuration settings and ntfs setting so that I can run this page (and
: many others). Thanks.
:
:
: Server Error in '/' Application.
: ------------------------------------------------------------ --------------------
:
: Security Exception
: Description: The application attempted to perform an operation not allowed
: by the security policy. To grant this application the required permission
: please contact your system administrator or change the application's trust
: level in the configuration file.
:
: Exception Details: System.Security.SecurityException: Exception from
: HRESULT: 0x800A0046 (CTL_E_PERMISSIONDENIED)
:
:
: Source File: c:\inetpub\wwwroot\hitit.aspx Line: 27
:
: Source Error:
: Line 25: visitorcount = visitorcount + 1
: Line 26: objCount.close
: Line 27: objCount = objFSO.CreateTextFile("counter.txt", True)
: Line 28: objCount.WriteLine(visitorcount)
: Line 29: end if
:
:
:

Re: CTL_E_PERMISSIONDENIED

am 05.04.2006 19:49:25 von Hans-Peter Sauer

On Wed, 5 Apr 2006 16:13:22 +1000, Ken Schaefer wrote:

> Hi,
>
> You probably need to change the trust level of your application to "Full"
> trust, in order to use the FSO to write files.
>
> This can be done in web.config.
>
> It is not an IIS or NTFS setting, but a .NET Framework setting
>
> Cheers
> Ken

Thanks for the reply. I have a web.config file in the web root directory
that says:








I have dug through help files until I am about blind. Is this the correct
syntax? It does not work with this?

Thanks.

Re: CTL_E_PERMISSIONDENIED

am 07.04.2006 02:23:39 von Ken Schaefer

You need to add a element, specifying a "full" level. See the
documentation here:
http://msdn.microsoft.com/library/default.asp?url=/library/e n-us/cpgenref/html/gngrftrustsection.asp

If this is a hosted site, your hosting company may have restricted you to a
lower trust level, which you can't just override to a higher level inside
your website. In that case you'd need to speak to your hosting company.

Cheers
Ken

--
IIS Blog: http://www.adOpenStatic.com/cs/blogs/ken

"MikeV06" wrote in message
news:1cuosohizh4tk$.dlg@mycomputer06.invalid.com...
: On Wed, 5 Apr 2006 16:13:22 +1000, Ken Schaefer wrote:
:
: > Hi,
: >
: > You probably need to change the trust level of your application to
"Full"
: > trust, in order to use the FSO to write files.
: >
: > This can be done in web.config.
: >
: > It is not an IIS or NTFS setting, but a .NET Framework setting
: >
: > Cheers
: > Ken
:
: Thanks for the reply. I have a web.config file in the web root directory
: that says:
:
:
: xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
:
:
:

:

:
: I have dug through help files until I am about blind. Is this the correct
: syntax? It does not work with this?
:
: Thanks.

Re: CTL_E_PERMISSIONDENIED

am 09.04.2006 22:44:43 von Hans-Peter Sauer

On Fri, 7 Apr 2006 10:23:39 +1000, Ken Schaefer wrote:

> You need to add a element, specifying a "full" level. See the
> documentation here:
> http://msdn.microsoft.com/library/default.asp?url=/library/e n-us/cpgenref/html/gngrftrustsection.asp
>
> If this is a hosted site, your hosting company may have restricted you to a
> lower trust level, which you can't just override to a higher level inside
> your website. In that case you'd need to speak to your hosting company.
>
> Cheers
> Ken

I believe the problem may lie with trying to run asp ver 1x code on an asp
ver 2.0 system. IIIUC, the code I am trying to execute is client side code
which cannot write to a local disk. Hence, the error. I think I need to
create a code behind page and let it do the work on the server. At least,
that is the direction I am now pursuing.

Thank you for your help though.

Re: CTL_E_PERMISSIONDENIED

am 10.04.2006 01:42:20 von Ken Schaefer

"MikeV06" wrote in message
news:204eakfjb34y.dlg@mycomputer06.invalid.com...
: On Fri, 7 Apr 2006 10:23:39 +1000, Ken Schaefer wrote:
:
: > You need to add a element, specifying a "full" level. See the
: > documentation here:
: >
http://msdn.microsoft.com/library/default.asp?url=/library/e n-us/cpgenref/html/gngrftrustsection.asp
: >
: > If this is a hosted site, your hosting company may have restricted you
to a
: > lower trust level, which you can't just override to a higher level
inside
: > your website. In that case you'd need to speak to your hosting company.
: >
: > Cheers
: > Ken
:
: I believe the problem may lie with trying to run asp ver 1x code on an asp
: ver 2.0 system. IIIUC, the code I am trying to execute is client side code
: which cannot write to a local disk. Hence, the error. I think I need to
: create a code behind page and let it do the work on the server. At least,
: that is the direction I am now pursuing.

Hi

ASP.NET code runs entirely on the server. All that the client sees is plain
HTML, CSS, Javascript etc. Changing the .NET version on the server might
only change the actual HTML output to the client, but doesn't change any
permissions on the client. You can't do that from the server.

Cheers
Ken

Re: CTL_E_PERMISSIONDENIED

am 10.04.2006 18:10:39 von Hans-Peter Sauer

On Mon, 10 Apr 2006 09:42:20 +1000, Ken Schaefer wrote:
>
> Hi
>
> ASP.NET code runs entirely on the server. All that the client sees is plain
> HTML, CSS, Javascript etc. Changing the .NET version on the server might
> only change the actual HTML output to the client, but doesn't change any
> permissions on the client. You can't do that from the server.
>
> Cheers
> Ken

I had to make liberal use of runat="server" as well as create a user
control (.ascx) page to do the actual computations. Once I did that, things
started to run.

Thanks for the pointers.