Hi,
I've just started writing in ASP.NET. I'm a bit new to this, so forgive me
for any newbie mistakes. I have a few questions. I'm trying to create a
logfile of people that visit my site, storing some info like IP, username,
and time. I'm trying to use streams in the code-behind page to append the
file, however I'm getting access denied errors and
System.UnAuthor izedAccessExcep tions thrown. How do I set the permissions to
allow access to that file?
My second issue is this, when I want to access a file; How do I use relative
addressing? I tried using this (it is in the aspx.cs file which is located
in "C:\inetpub\www root\testweb")
StreamWriter outStream = new StreamWriter("./logfile.txt",tr ue);
to access a file that is physically located at
"C:\inetpub\www root\testweb\lo gfile.txt". I would assume it would access
files relative to the location of the page (aspx and aspx.cs), but whenever
I run it, it goes to the C:\windows\syst em32 directory. Is there anyway to
change it so that the paths are relative to where the page is run from?
Thanks,
Jim
talyn009@gmail. com
I've just started writing in ASP.NET. I'm a bit new to this, so forgive me
for any newbie mistakes. I have a few questions. I'm trying to create a
logfile of people that visit my site, storing some info like IP, username,
and time. I'm trying to use streams in the code-behind page to append the
file, however I'm getting access denied errors and
System.UnAuthor izedAccessExcep tions thrown. How do I set the permissions to
allow access to that file?
My second issue is this, when I want to access a file; How do I use relative
addressing? I tried using this (it is in the aspx.cs file which is located
in "C:\inetpub\www root\testweb")
StreamWriter outStream = new StreamWriter("./logfile.txt",tr ue);
to access a file that is physically located at
"C:\inetpub\www root\testweb\lo gfile.txt". I would assume it would access
files relative to the location of the page (aspx and aspx.cs), but whenever
I run it, it goes to the C:\windows\syst em32 directory. Is there anyway to
change it so that the paths are relative to where the page is run from?
Thanks,
Jim
talyn009@gmail. com
Comment