PDA

View Full Version : How do I write a .csv to disk?


screamingsa
11-01-2003, 08:08 AM
I need some assistance from all of you web gurus... I'm trying to write a file to disk and keep getting the error:

Exception Details: System.UnauthorizedAccessException: Access to the path "c:\windows\system32\inetsrv\myfile.csv" is denied.

I don't want to write to c: -- I want to write to a folder (e.g. downloads on my site) I'm using filename = "~/" & myfilename right now and I guess this isn't the correct syntax... Is anyone out there that could provide some help?

Thanks!

Lance

mnye
11-04-2003, 11:53 AM
if you want to write the folder to the same path as the website directory call your file this:

Server.Path("myfile.csv")

the reason you are getting access denied is because when you put
"~/" & myfilename it will save your file to the system folder. the aspnet user probably doesnt have write access to the system folder.

hth
matt

jacobfavre
11-17-2003, 07:37 AM
I used server.MapPath("whatever.txt")

screamingsa
11-18-2003, 04:48 AM
Thanks Guys!