Let my try to explain: the question makes no sense at all, no matter if you find the path correctly or not. Just to close this part of the issue: you can easily run your code under the debugger and see the calculated path name, compare it with the place your file really is. Maybe you need to understand that the '~' part of the path used by
MapPath
corresponds to the root directory set up to your site (and not to the root directory of any disk volume!). This is way too simple; only you can do it, but
it won't help you in this case.
The major problem is different:
You are trying to play sound on the server side. But nobody there wants to hear your sound. Let's see: you say that your sound at @"G:\backup\LTM.CTP.WEBFORM\LTM.CTP.WEBFORM\Audio\q1.wav" "works fine". It can mean only one thing: you hear your sound because your server site is hosted on the same computer as your client side, or, let's assume the unlikely, on some computer in the same room as your development computer. It's likely that you are just using development HTTP server. Strictly speaking,
you simply don't do any Web development. Yes, it's quite possible to do fully-fledged Web development on the development server or any other way using only the local host, but it's possible if you understand what you are doing. Note that there are no situations when hard-coded path name can be useful, and this is especially true for any Web development. It should be obvious enough. Your file "works fine" only
by accident.
Also, it's pretty bad to use uncompressed WAV format.
What to do? Strictly speaking, it can be explained only if you explain what you want to achieve clearly. If you want to upload a file and them play it,
it should be downloaded back to the client side and then played locally with JavaScript or HTML5
audio
element:
Let me google that for you[
^],
Web Audio API — Web APIs | MDN[
^],
HTML5 Audio — Wikipedia, the free encyclopedia[
^].
—SA