Accessing file denied - Urgent!!!

D

David Li

Hi all,

I was trying to read/write to a file under the ASP.NET web application's
root directory. After some configurations, e.g. Enabling 'Impersonate',
Assigning correct pemissions to ASPNET accounts for this file, the program
ran very well. However when I put it on another server, it appears the
system is trying to locate the file under "C:\Winnt\System32" and I got
"Unauthorized Exception". This file IS under the web application root
directory, and I tried to put "~/" or "./" before the file name, it didn't
work either! Any ideas? Thank you in advance!!!


David
 
C

Cirrosi

It will be usefull know how you write this file, however to know the
phisical location of your application you must use server.mappath function.
 
D

David Li

Hi Cirrosi,

Just very simple File.IO, TextReader/TextWriter stuffs (trying a quick&dirty
way for one of my coworker). And I am trying to do something with
Server.MapPath now...


David
 
S

Scott Allen

Hi David:

Use Server.MapPath to generate the correct physical location of the
file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top