ASP.NET absolute path to file

J

Jovo Mirkovic

Hi,

I want to play a MIDI file in browser, but I must give a full path to
WMP control... In that case everyone can simple type full path in
browser and save my midi file... I do not like it... I wont thet they
can listen miti, but that is not possible save it...

How I can do taht in ASP.NET / VB.NET...

Thanks!

Jovo Mirkovic
 
S

Steve C. Orr [MVP, MCSD]

You can have a special page that acts as a gateway to the file.
Put the midi file in a secured folder, then from within your special page
(after you've determined the user is authorized) use Response.Writefile to
send the midi file to the browser.

Code something along these lines should work:
Response.Clear()
Response.ContentType = Whatever
Response.Writefile("c:\song.midi")
Response.AddHeader("Content-Disposition", _
"inline;filename=song.midi")
Response.End()

Here's more info on Response.WriteFile
http://msdn.microsoft.com/library/d...fsystemwebhttpresponseclasswritefiletopic.asp
 
M

Mythran

Jovo Mirkovic said:
Thanks Steve!

Not sure you know this...:

Fictional Situation :

1.) I am a hacker.
2.) You place the file on the server and have a page write the file to the
client:
3.) I write a program that requests this page and saves it to a file.

Purpose Defeated.

Anywho, the answer is, if someone can listen to it remotely on their
machine, then it can always be saved to disk. I don't like that as much as
anyone else, but it is the truth...for now...

Mythran
 
S

Steve C. Orr [MVP, MCSD]

This is why I specified that he allow the file to be downloaded only after
he's authenticated the user.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top