file access question in c# dll

J

jason

saw another thread on this topic, but no solutions were presented, so
here is my question:

i have a c# class library dll that must access a config-like text file.
when using the FileStream constructor, it seems to attempt to open the
file from the directory that the parent process (the one utilizing the
class library) is running from.

in this case it is a classic ASP application, so it is trying to find
the config file in the SYSTEM32 directory.

is there any way for the class library i wrote to access a text file in
it's OWN directory, whereever that might happen to be? instead of
looking in the directory of the parent process?

thanks for any help,

jason
 
Y

Yunus Emre ALPÖZEN [MCAD.NET]

You can use a static write only property to set current working folder. And
at the begining of your application you can set it.

public class SomeClass
{
private string path;
public static WorkingPath
{
set
{
path=value;
}
}
}
 

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

Top