How can I get relative path in Class Library?

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....
 
H

handlim

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,,,
 
R

Rajesh.V

Pass the Server object to the function or constructor.
Then u can access the function mappath.
 
R

Rajesh.V

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

}
 

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,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top