I am working on an ASP.NET MVC 5 application where the user can upload videos. I've noticed a problem where sometimes the videos are not found because it appears that they have duplicate file extensions.
What is confusing me is inside the debugger I get the correct path...
C:\Users\MyUser\Documents\visual studio 2013\Projects\MyStructures\MyStructures\Content\Videos\bbb.mp4
but it is not showing in the content folder in Visual Studio.
When I open that folder using File Explorer the file is there.
The code that displays the video pulls the filename from the database.
@if (!string.IsNullOrEmpty(post.VideoFileName))
{
<div>
<video width="400" controls>
<source src="~/Content/Videos/@post.VideoFileName" type="video/mp4">
<source src="~/Content/Videos/@post.VideoFileName" type="video/ogg">
<source src="~/Content/Videos/@post.VideoFileName" type="video/webm">
<p>Your browser does not support HTML5 video.</p>
</video></div>
}
How can I check for and remove these duplicate file extensions using C#?