location

farshad

Well-known member
Joined
May 1, 2003
Messages
109
Location
London
Hi,
I have been working on the same location path issue fo rsometime now. Using the path as below plays the .wav fine wheras on the web hosting company it just doesnt.
Here is what I have.

Private Function WavPath() As String
Return Server.MapPath(Request.ApplicationPath) & "\WavFiles\"
End Function

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
PlayWav(WavPath() & "202.wav")
End If
End Sub

I have even tried using Server.MapPath("WavFiles\202.wav") but no success.
Can you see what the problem is?
Thanks
 
Hi,
Thanks for trying but unfortunately does does not work either.
This may give you some clues.
Running these...
Response.Write(Server.MapPath(Request.ApplicationPath) & "<br>")
Response.Write(Server.MapPath("/WavFiles") & "<br>")
Response.Write(Server.MapPath("\WavFiles") & "<br>")
Response.Write(Server.MapPath("WavFiles") & "<br>")
Response.Write(Server.MapPath("WavFiles\202.wav") & "<br>")
Response.Write(Server.MapPath("WavFiles/202.wav") & "<br>")
Response.Write(Server.MapPath("\WavFiles\202.wav") & "<br>")
Response.Write(server.MapPath("/WavFiles/202.wav") & "<br>")
Response.Flush()
Response.End()


produces these...
The results is:
e:\home\fmardanie:\home\fmardani\WavFiles
e:\home\fmardani\WavFiles
e:\home\fmardani\WavFiles
e:\home\fmardani\WavFiles\202.wav
e:\home\fmardani\WavFiles\202.wav
e:\home\fmardani\WavFiles\202.wav
e:\home\fmardani\WavFiles\202.wav
 
But what does the one I suggested produce?

Try to not use Server.MapPath if at all possible and if you ever "have to" use it, which isnt likely, you should cache the results or it can hinder performance.
 
Response.Write(Request.PhysicalApplicationPath & "\WavFiles\")
produces:
e:\home\fmardani\\WavFiles\
Thanks again for the time you sre spending on this...
 
I not really understand your problem, actually what is the actual path?

if Request.PhysicalApplicationPath not help, You can try this:

[VB]
System.AppDomain.CurrentDomain.BaseDirectory
[/VB]
 
Originally posted by farshad
Response.Write(Request.PhysicalApplicationPath & "\WavFiles\")
produces:
e:\home\fmardani\\WavFiles\

Just a note, it produces an invalid path because you dont need "\WavFiles\", just "WavFiles"
 
Back
Top