NotSupportedException: Path 'wwwroot\myfolder\filename.txt' was not rooted

Question: How do you solve for the error in Asp.Net 6 that says "NotSupportedException: Path 'wwwroot\myfolder\filename.txt' was not rooted" An unhandled exception occurred while processing the request?

Answer: Chances are that you are trying to use the path to the directory in your project but then the path is not all the way complete. Asp.Net 6 Runtime would like to know the complete path starting from the Root Directory such as the "C" or "D" drive. In this case, you only provided "\wwwroot\myfolder\filename.txt" and the compiler got confused.

How to solve this error:
1. Just add


Edit this Article
If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

Your Session is Ending
Login to Continue

© 2022 - ErnesTech - Privacy