Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Delete file with Illegal Characters in Filemanager



My customer accidentally managed to upload a file with illegal characters using the FileManager in EPiserver 7.1

This results in an yellow screen of death stating " System.ArgumentException: Illegal characters in path".

The error message also seems to give the id of the file.

What is the best way to remove this file and fix the error, making sure there are no left out paths/pointers in the database etc?

Bare in mind, I'm not really familiar with this environment since I've mostly worked with 7.5. 



May 06, 2016 8:39

If you are using 7.1 you need to use virtual path provider to programmatically work with files since contentrepository will only work with files from 7.5+. Try first to change the regex that validates files and see if that lets you delete it with file manager. Else do a scheduled job or similar that use virtual path provider and delete it programmatically. 

Check out

For how to work with these. It should be something similar to

    UnifiedFile file =
        as UnifiedFile;

...but I don't have a 7.1 environement up right now to check.

If you are using native provide type you can just delete the file. 

Edited, May 06, 2016 8:59
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.