J
Jennifer
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
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