Fixed issue in Settings.PublicDirectory (only occurring when PublicDirectory is empty in web.config).

This commit is contained in:
Dario Solera 2009-10-05 07:11:36 +00:00
parent ba86e8c23d
commit 4dee300bf4
2 changed files with 4 additions and 3 deletions

View file

@ -16,5 +16,5 @@ using System.Reflection;
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("3.0.0.337")] [assembly: AssemblyVersion("3.0.0.338")]
[assembly: AssemblyFileVersion("3.0.0.337")] [assembly: AssemblyFileVersion("3.0.0.338")]

View file

@ -156,8 +156,9 @@ namespace ScrewTurn.Wiki {
public static string PublicDirectoryName { public static string PublicDirectoryName {
get { get {
string dir = WebConfigurationManager.AppSettings["PublicDirectory"]; string dir = WebConfigurationManager.AppSettings["PublicDirectory"];
if(string.IsNullOrEmpty(dir)) throw new InvalidConfigurationException("PublicDirectory cannot be empty or null");
dir = dir.Trim('\\', '/'); // Remove '/' and '\' from head and tail dir = dir.Trim('\\', '/'); // Remove '/' and '\' from head and tail
if(dir == null || dir.Length == 0) throw new Exception("PublicDirectory cannot be null."); if(string.IsNullOrEmpty(dir)) throw new InvalidConfigurationException("PublicDirectory cannot be empty or null");
else return dir; else return dir;
} }
} }