I'm trying to get an ASP.Net Web Application to be able to write a long filename but keep getting a System.IO.PathTooLongException
.
https://learn.microsoft.com/en-us/dotnet/api/system.io.pathtoolongexception?view=netframework-4.8
File.WriteAllText(@"C:\LongFileName" + new string('0', 500) + ".txt", "LongFileName");
I've tried setting group policy and registry settings to enable long file paths. This hasn't worked. I've tried adding an app.manifest
file to my project with the following.
<?xml version="1.0" encoding="utf-8"?>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
This still isn't working. I'm wondering if the issue is that it being a web application I cannot have a manifest file and this needs to be a setting for IIS Express?