How can I get relative path in Class Library?

Discussion in 'ASP .Net' started by handlim, Oct 28, 2003.

  1. handlim

    handlim Guest

    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....
    handlim, Oct 28, 2003
    #1
    1. Advertising

  2. handlim

    handlim Guest

    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,,,
    handlim, Oct 28, 2003
    #2
    1. Advertising

  3. handlim

    Rajesh.V Guest

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

    "handlim" <> wrote in message
    news:...
    > 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....
    Rajesh.V, Oct 28, 2003
    #3
  4. handlim

    Rajesh.V Guest

    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

    }

    "handlim" <> wrote in message
    news:...
    > 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,,,
    Rajesh.V, Oct 29, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    3
    Views:
    19,545
    Sudsy
    Jul 8, 2004
  2. Thomas Guettler
    Replies:
    3
    Views:
    754
    Andrei
    Oct 27, 2003
  3. Oren
    Replies:
    1
    Views:
    541
    Michael D. Ober
    Apr 29, 2007
  4. Zoran Lazarevic

    Library path relative to current .rb file

    Zoran Lazarevic, Nov 24, 2003, in forum: Ruby
    Replies:
    11
    Views:
    274
    Paul Brannan
    Nov 26, 2003
  5. Nigel Wilkinson
    Replies:
    2
    Views:
    382
    Nigel Wilkinson
    Jul 25, 2005
Loading...

Share This Page