How can I get relative path in Class Library?

  • Thread starter Thread starter handlim
  • Start date Start date
H

handlim

I am trying to make some program with XML in class library by C#.
I read XML file in my program by using oXmlDoc.Load(xmlfilename);
But, It occured error... It read from C:\windows\system32,,, But my
XML file is in same directory with my program.
So, I know I have to use relative path....
Who knows how to get relative path in class library?

Is there anyone who know this solution...

Please,,,Help me,,,,

I will appreciate....
 
Thank you for your answer,,,

But, Can I use the server object in class library,,,

If yes,,, How can I use it?

I tried several times to use the server object in class library,,, But I can't.

Please, Give me any solution,,,,

anyway, Thank for your answer,,,

Have good days,,,
 
Pass the Server object to the function or constructor.
Then u can access the function mappath.
 
Say your function is
private void MyFunction(string str1)
{

}

Convert it to

using System.Web.UI;

MyFunction(string str1, Page.Server srvr)
{

--- no u can use the srvr.MapPath() function here

}
 
Back
Top