In this article I will explain with an example, how to play Audio files from Server Folder (Directory) in ASP.Net.
 
 

Files Folder Locations

The Audio file is stored in the Files Folder (Directory).
Play Audio file in ASP.Net Web Forms
 
 

HTML Markup

The HTML Markup consists of following elements:
audio – For playing audios.
Note: This article makes use of HTML5 Audio Player to play the audios on the web page.
 
Inside the HTML5 Audio element, the source tag is added. The source tag is specified with following attributes:
src: URL of the Audio file.
type: The MIME type of the Audio file.
Following are the compatible Media Types for Audio.
File Format
Media Type
MP3
audio/mpeg
OGG
audio/ogg
WAV
audio/wav
 
<audio controls="controls">
     <source src="/Files/Kalimba.mp3" type='audio/mpeg' />
</audio>
 
 

Screenshot

Play Audio file in ASP.Net Web Forms
 
 

Browser Compatibility

The above code has been tested in the following browsers only in versions that support HTML5.
Microsoft Edge  FireFox  Chrome  Safari  Opera
* All browser logos displayed above are property of their respective owners.
 
 

Demo

 
 

Downloads



Other available versions