Security Error - Writing to a Text File
From: Jennifer (jennifer1970_at_hotmail.com)
Date: 08/12/04
- Next message: Alex Papadimoulis: "RE: Function Pointers?"
- Previous message: Imran Koradia: "Re: Function Pointers?"
- Next in thread: Jason: "Re: Security Error - Writing to a Text File"
- Reply: Jason: "Re: Security Error - Writing to a Text File"
- Reply: Paul Clement: "Re: Security Error - Writing to a Text File"
- Messages sorted by: [ date ] [ thread ]
Date: 12 Aug 2004 11:50:53 -0700
On an ASP page I've got some code that is supposed to "export" data in
a grid to an Excel file. What I'm doing is writing all the data to a
text file, separating the fields by commas. Then I'll redirect the
user to a new page with the file that was just created.
Code:
Dim objFSO, objTextFile
Dim sRead, sReadLine, sReadAll
Const ForReading = 1, ForWriting = 2, ForAppending = 8
objFSO = CreateObject("Scripting.FileSystemObject")
objTextFile = objFSO.CreateTextFile
("C:\Inetpub\wwwroot\WhatacoDailyReport\Test.CSV", True)
objTextFile.WriteLine(sFieldValues)
objTextFile.Close()
Response.Redirect("/whatacodailyreport/test.csv")
I'm getting the following error:
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).
The program errors out on the CreateObject line.
Now, here's what I've done to try to fix it:
I've turned off anonymous access by taking the following steps:
1. Right click on My Computer and select "Manage"
2. Expand "Services and Applications" in the Tree View
3. Expand "Internet Information Services"
4. Expand "Web Site"
5. Expand "Default Web Site"
6. Right click on your application and select "Properties"
7. Select the "Directory Security" tab
8. Click the "Edit..." button
9. Uncheck "Anonymous Access"
Under the Directory tab I've checked Script Source Access, Read,
Write, Log Visits and Index This Resource. Also, under Application
Settings I was not sure what, if anything, to change.
Also, this is my own personal computer, so why am I denied access?
Any suggestions would be helpful.
Thanks,
Jennifer
- Next message: Alex Papadimoulis: "RE: Function Pointers?"
- Previous message: Imran Koradia: "Re: Function Pointers?"
- Next in thread: Jason: "Re: Security Error - Writing to a Text File"
- Reply: Jason: "Re: Security Error - Writing to a Text File"
- Reply: Paul Clement: "Re: Security Error - Writing to a Text File"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|