How do I choose the default file and not hardcoded?

I want to select the dtd XHTML file from a default location such as the bin folder (where the exe file of the project is located) rather than hard-code it by specifying the exact file path like C: \ temp \ xhtml1.dtd, My code is in C #. Can anyone help how to do this?

0


a source to share


2 answers


One option is to use the application base:



string path = Path.Combine(
            AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
            "foo.dtd");

      

+3


a source


I think this might be what you want?



string xhtml = Directory.GetCurrentDirectory()+"xhtml1.dtd";

      

0


a source







All Articles