accessing a file from DLL that's located in Bin directory

J

Joo Park

Hello,

I have a dll in the bin directory of my website. The dll needs to load a
file in the bin directory as well.

This piece of code does not seem to work.

File_Name ="myfile.txt";
fs = new FileStream(FILE_NAME, FileMode.Open, FileAccess.Read);

Both the file and the dll are in the same directory.

What am I doing wrong and How do i get this to work?



thank you in advance!
 
B

bruce barker

in asp.net the working directory winnt\system32. also asp.net copies the dll
to temp dir before loading. you should use the Server.MapPath() to get the
physical path to the bin directory.

-- bruce (sqlwork.com)



| Hello,
|
| I have a dll in the bin directory of my website. The dll needs to load a
| file in the bin directory as well.
|
| This piece of code does not seem to work.
|
| File_Name ="myfile.txt";
| fs = new FileStream(FILE_NAME, FileMode.Open, FileAccess.Read);
|
| Both the file and the dll are in the same directory.
|
| What am I doing wrong and How do i get this to work?
|
|
|
| thank you in advance!
|
|
|
|
|
|
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top