Play background music on page load in ASP.Net

Step 1:

First of all take a hidden field control in asp.net web page and bind to the hidden field control from database which contains the URL of the .mp3 file.

Step 2:

Place the below code inside <head>  tag or if the webpage has master page then put the below code inside <asp:Content> tag on your webform

<script type="text/javascript">
    function play() {
        var audioValue = document.getElementById('<%=audioHidden.ClientID%>').value;
        //alert(audioValue);
        embed = document.createElement("embed");
        embed.setAttribute("src", audioValue);
        embed.setAttribute("hidden", true);
        embed.setAttribute("autostart", true);
        document.body.appendChild(embed);
    }
    window.onload = function () {
        play();
    }
</script>