Why is HttpRuntime.AppDomainAppPath returning the wrong wrapped path?
I have an application where HttpRuntime.AppDomainAppPath returns the correct path with the wrong case.
Then I am trying to use this in String.Replace and it cannot find the path in the filename because of the shell.
I am aware that I can use Regex.Replace, but would prefer not to.
I only have this problem on a production machine, even if the corresponding folder has the same corpus in dev.
I just noticed that Server.MapPath is returning the wrong case as well.
Any ideas?
source to share
Apparently the problem was in the site directory specified with the wrong corpus in IIS. Merely changing the home directory does not help the problem as these values ββare already set in the metabase and apparently because windows are not case sensitive it does not fix the metabase when correcting it in the GUI.
I ended up deleting the site and adding it again since it is not in use yet. Perhaps I could completely change the directory name and change the location in the GUI just as effectively.
source to share
A few things:
If you don't care about the case, use .ToUpper or .ToLower and replace it.
Dim path As String = HttpRuntime.AppDomainAppPath.ToUpper
Dim newpath As String = Replace(path, "fnd", "rplc")
If that's not an option, try changing the comparison method in your replace function.
You have not specified the language, so I cannot give a specific example.
source to share