473,491 Members | 2,221 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How can I get relative path in Class Library?

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....
Nov 17 '05 #1
3 9003
Pass the Server object to the function or constructor.
Then u can access the function mappath.

"handlim" <ha*****@hotmail.com> wrote in message
news:6c**************************@posting.google.c om...
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....

Nov 17 '05 #2
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,,,
Nov 17 '05 #3
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" <ha*****@hotmail.com> wrote in message
news:6c*************************@posting.google.co m...
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,,,

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1415
by: peter | last post by:
Hello all, I've read all the posts concerning relative imports of modules and I am glad I saw some consensus on a syntax. At this moment I am however bound to python 2.3. Does anyone know a...
1
1343
by: draco | last post by:
Hi, Let's say I have a dynamic library libapple.so with a method applemethod() which expects a filename string. I call this method from main() which is in the file foo.c. Now foo.c and apple.so...
4
4775
by: Julia | last post by:
Hi, I have two application which 'evaluate'( New FileStream(path....) relative path, when evaluating the path inside a window service it always return something like ...
2
2662
by: Ben Fidge | last post by:
Is there any Framework classes that allow you to provide a URL as a string, and determine whether it is a relative URL or literal URL? Once that's determined, I'd then like to remove the protocol...
18
9415
by: Nak | last post by:
Hi there, Does anyone know what path the AssemblyKeyFile attribute is relative to? For example I currently have mine set to <Assembly: AssemblyKeyFile("..\NicksKey.snk")> Sometimes this...
1
3580
by: W1ld0ne [MCSD] | last post by:
In VB6 dlls' I could get the path of the calling web site by using the COM+ class library and the ASP class library. Does anyone have a clue how to do this in VB.Net The objective is to have...
8
2590
by: JJ | last post by:
I'm confused about paths. I have a functionn that uses the mappath method, which I think requires a virtual path (is that the same as a relative path?). But this doesn't always work as the...
2
3504
chathura86
by: chathura86 | last post by:
I'm new to ASP.NET i'm new to asp.net i created a class which reads a xml file placed the class in the app_code folder and placed the xml file in another folder both folders are in the root ...
4
1842
chathura86
by: chathura86 | last post by:
i have created some php classes in deferent folders which requires each other i have given relative paths relative to those files i used require_once() but when i use those class in a file...
0
6978
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7154
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7360
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5451
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4881
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
280
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.