I am attempting to enable long path support on a web application. I have followed the instruction here and was able to get long paths working on a simple console app. When I translate the same concept to a web application (Using the web.config instead of the app.config) System.IO blows up with the following exception.
at System.IO.PathHelper.GetFullPathName()
at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetFullPathInternal(String path)
at System.IO.DirectoryInfo.Init(String path, Boolean checkHost)
The line of code that I am running both on the web app and console app is
Dim dirInfo As New DirectoryInfo("\\fileserver\systems\devFramework\Deploy\DEV\11424495\Rollback_1314799492608780699\Rolloutsuperdupersongpathtestasdfasdfaasdfasasdfasadsfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfadsfasdfasdfasdfasdfasdfasddfasdfasdfasfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdftestadditionalcharacters")
Since both are using System.IO I dont understand what the issue could be. I have also tried adding the switches in code using
System.AppContext.SetSwitch("Switch.System.IO.UseLegacyPathHandling", False)
System.AppContext.SetSwitch("Switch.System.IO.BlockLongPaths", False)
as explained here
Nothing seems to work. Any advice would be greatly appreciated.