1

Today for testing I'm using:

XmlReader ProductDoc = XmlReader.Create(@"c:\inetpub\wwwroot\data\xml\foo\bar.xml", settings);

I need to make this more relative instead of a fully qualified name but can't seem to find a way to make it work.

I really don't have a lot of access to the web.config file and so don't want to go there.

Ideas?

1 Answer 1

2

This is What you need

Server.MapPath("/data/xml/foo/bar.xml")

Documentation is present here

Sign up to request clarification or add additional context in comments.

1 Comment

Awesome. Thanks. I knew it'd be simple. I used 'string path = Server.MapPath(@"\data\xml\foo\bar.xml");XmlReader ProductDoc = XmlReader.Create(path, settings);'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.