none
ArgumentException (Illegal characters in path) RRS feed

  • Question

  •  

    Hi, previously our project read/write files at "application.startuppath" and now we wish to switch the location to "application.commonappdatapath" but it return error and application just halt/crash

     

     

    Application.StartupPath & "\xmlFontSetting.xml" - Works Fine

     

    Application.CommonAppDataPath & "\xmlFontSetting.xml" - return error  - ArgumentException (Illegal characters in path)

     

    What is the problem here?

     

     

    p/s: it works in vs2005 but not vs2008

    Wednesday, April 23, 2008 1:09 AM

Answers

  • Have a look at Application.CommonAppDataPath.

     

    It's a subfolder of Environment.SpecialFolder.CommonApplicationData built using the company name, product name and product version.

     

    This can go wrong if:

     

    a) you're running under an account without a profile (e.g. a server app or windows service)

    b) your CompanyName, ProductName or AssemblyInformationalVersion/AssemblyVersion attributes contain characters that are illegal in a path.

     

     

    Wednesday, April 23, 2008 5:09 AM

All replies

  • Have a look at Application.CommonAppDataPath.

     

    It's a subfolder of Environment.SpecialFolder.CommonApplicationData built using the company name, product name and product version.

     

    This can go wrong if:

     

    a) you're running under an account without a profile (e.g. a server app or windows service)

    b) your CompanyName, ProductName or AssemblyInformationalVersion/AssemblyVersion attributes contain characters that are illegal in a path.

     

     

    Wednesday, April 23, 2008 5:09 AM
  • you are right, i checked the assembly and yes it contains illegal characters symbol..

    thanks alot

    Friday, April 25, 2008 9:07 AM