The configSource attribute must be a relative physical path, so the '/' character is not allowed.

Last post 02-18-2009 7:59 AM by Sonu. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 03-10-2008 12:35 PM

    • Garry
    • Top 100 Contributor
    • Joined on 02-20-2008
    • Wannabe Slacker
    • Points 184

    The configSource attribute must be a relative physical path, so the '/' character is not allowed.

    Hi,

    I have used the connectionSting element of the web.config to set the configSource. My ConnectionStrings.config file is on a subfolder. However when I change the configSource element to read the sub folder then I am not able to get it working. Here is how it looks:

    This does not work 

    <connectionStrings configSource="configs/connectionStringsDEV.config" />

    This works (however the connectionStringsDEV.config  file needs to be in the root folder): 

    <connectionStrings configSource="connectionStringsDEV.config" />

    Any ideas?

  •  Advertisement

    Featured Advertisement

     
  • 03-10-2008 1:46 PM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: The configSource attribute must be a relative physical path, so the '/' character is not allowed.

    Try with a backslash instead:

    <connectionStrings configSource="configs\connectionStringsDEV.config" />

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
  • 02-18-2009 7:39 AM In reply to

    Re: The configSource attribute must be a relative physical path, so the '/' character is not allowed.

    Hello Sonu,

     

    Is it possible to define path's like : <connectionStrings configSource="..\..\configs\connectionStringsDEV.config" />?

    I've tryed that and it's giving me the following error:

    The configSource attribute is invalid.: The configSource '..\..\config\ExternalConnectionStrings.config' is invalid. It must refer to a file in the same directory or in a subdirectory as the configuration file.
    

    Best regards,

    Manuel

  • 02-18-2009 7:43 AM In reply to

    Re: The configSource attribute must be a relative physical path, so the '/' character is not allowed.

    Hello Sonu,

    Is it possible to define relative paths in any manner?

    I've tryed the following: <connectionStrings configSource="..\..\config\ExternalConnectionStrings.config"> and it's giving me the following error:

    The configSource attribute is invalid.: The configSource '..\..\config\ExternalConnectionStrings.config' is invalid. It must refer to a file in the same directory or in a subdirectory as the configuration file.

     

    Best regards,

    Manuel

    * sory for the repeated post, when  i hit submit it's giving me 404 error...but inserted the request.

  • 02-18-2009 7:44 AM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: The configSource attribute must be a relative physical path, so the '/' character is not allowed.

    Unfortunately no. As the error message says:

    It must refer to a file in the same directory or in a subdirectory as the configuration file.

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
  • 02-18-2009 7:51 AM In reply to

    Re: The configSource attribute must be a relative physical path, so the '/' character is not allowed.

    Thanks Sonu for the fast reply,

    Do you recommend any methodology to conn string management?

    I have a VS solution with several projects, and some use the same connectioString. How can a put the connectionString in an external file and in a configuration folder (located wherever i want)?

    Thanks,

    Manuel

  • 02-18-2009 7:59 AM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: The configSource attribute must be a relative physical path, so the '/' character is not allowed.

    I usually have my web.config in the root and my config files in the /configs folder. Maybe you could try the same.

    Otherwise I really do not see any way to place the config files into a parent folder. You might also want to read up the following reported feedback about this topic:

    http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=93626

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
Page 1 of 1 (7 items)