Home All Groups Group Topic Archive Search About
Author
4 Apr 2006 10:57 PM
MikeV06
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

Author
5 Apr 2006 6:13 AM
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

Show quoteHide quote
"MikeV06" <m*@privacy.net> 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
:
:
:
Author
5 Apr 2006 5:49 PM
MikeV06
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:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <appSettings>
        <add key="hitit.aspx" value="full" />
    </appSettings>
</configuration>

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

Thanks.
Author
7 Apr 2006 12:23 AM
Ken Schaefer
You need to add a <trust> element, specifying a "full" level. See the
documentation here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-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

Show quoteHide quote
"MikeV06" <m*@privacy.net> 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:
:
: <?xml version="1.0" encoding="utf-8"?>
: <configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
Show quoteHide quote
:    <appSettings>
:        <add key="hitit.aspx" value="full" />
:    </appSettings>
: </configuration>
:
: I have dug through help files until I am about blind. Is this the correct
: syntax? It does not work with this?
:
: Thanks.
Author
9 Apr 2006 8:44 PM
MikeV06
On Fri, 7 Apr 2006 10:23:39 +1000, Ken Schaefer wrote:

> You need to add a <trust> element, specifying a "full" level. See the
> documentation here:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-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.
Author
9 Apr 2006 11:42 PM
Ken Schaefer
"MikeV06" <m*@privacy.net> 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 <trust> element, specifying a "full" level. See the
: > documentation here:
: >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrftrustsection.asp
Show quote Hide quote
: >
: > 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
Author
10 Apr 2006 4:10 PM
MikeV06
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.