Get MP3 file duration/length
C# code for if you are trying to get the mp3 length or duration of a media file. You will need to reference Windows Media Player. Go to Com Add-ins to add the wmp.dll to your project.
string Duration = null;
WMPLib.WindowsMediaPlayer w = new WMPLib.WindowsMediaPlayer();
WMPLib.IWMPMedia m = w.newMedia(Filename);
if (m != null) {
Duration = m.durationString;
}
w.close();
Replace line breaks with BR tags
In Classic ASP we used to replace line breaks or vbCrLf tags in the following way.
strValue = Replace(strValue, vbCrLf, "<br>")
In ASP.NET it is a bit different. Now we have the Environment.NewLine command that will determine the coding environment you are running in either VB or C#. So you can replace the line break command wether it is vbCrLf or /n.
string strValue = strValue;
strValue.Text = strValue.Replace(Environment.NewLine, "<br/>");



