URI class - real newbie here

G

GeezerButler

The URI class seems to be able to load a file on local machine where
the path is absolute i.e. like D://abc.xml.
The funny part is that if i make a WebRequest to request this uri, i do
get a response? (I wonder how).

Note: I do not have IIS installed.

So i was wondering if it would be able to load a filepath that is
relative to my dll/exe. Something like ../my folder/abc.xml.
But the URI class fails to load this string, saying that it is in
invalid format.
Is it somehow possible to load a filepath relative to my dll/exe.

BTW i need to do this to test my app's behaviour with different xml
files.
Is it possible to setup some kind of a local server on my machine
(without having IIS)?
 
M

Michael Nemtsev

Hello GeezerButler,

Use Server.MapPath to resolve your path

---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

G> The URI class seems to be able to load a file on local machine where
G> the path is absolute i.e. like D://abc.xml.
G> The funny part is that if i make a WebRequest to request this uri, i
G> do
G> get a response? (I wonder how).
G> Note: I do not have IIS installed.
G>
G> So i was wondering if it would be able to load a filepath that is
G> relative to my dll/exe. Something like ../my folder/abc.xml.
G> But the URI class fails to load this string, saying that it is in
G> invalid format.
G> Is it somehow possible to load a filepath relative to my dll/exe.
G> BTW i need to do this to test my app's behaviour with different xml
G> files.
G> Is it possible to setup some kind of a local server on my machine
G> (without having IIS)?
 

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

Top