ASP.NET absolute path to file

Discussion in 'ASP .Net Web Controls' started by Jovo Mirkovic, May 26, 2005.

  1. 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

    *** Sent via Developersdex http://www.developersdex.com ***
    Jovo Mirkovic, May 26, 2005
    #1
    1. Advertising

  2. 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

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "Jovo Mirkovic" <> wrote in message
    news:%...
    >
    > 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
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    Steve C. Orr [MVP, MCSD], May 26, 2005
    #2
    1. Advertising

  3. Jovo Mirkovic, May 26, 2005
    #3
  4. Jovo Mirkovic

    Mythran Guest

    "Jovo Mirkovic" <> wrote in message
    news:...
    >
    > Thanks Steve!
    >
    > *** Sent via Developersdex http://www.developersdex.com ***


    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
    Mythran, May 28, 2005
    #4
  5. This is why I specified that he allow the file to be downloaded only after
    he's authenticated the user.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "Mythran" <> wrote in message
    news:...
    >
    > "Jovo Mirkovic" <> wrote in message
    > news:...
    >>
    >> Thanks Steve!
    >>
    >> *** Sent via Developersdex http://www.developersdex.com ***

    >
    > 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
    >
    Steve C. Orr [MVP, MCSD], May 29, 2005
    #5
  6. Jovo Mirkovic

    Mythran Guest

    "Steve C. Orr [MVP, MCSD]" <> wrote in message
    news:e5$...
    > This is why I specified that he allow the file to be downloaded only after
    > he's authenticated the user.
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://SteveOrr.net
    >



    Yes, you are right :)

    Mythran
    Mythran, May 31, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    3
    Views:
    19,502
    Sudsy
    Jul 8, 2004
  2. Replies:
    10
    Views:
    3,479
  3. Thomas Guettler
    Replies:
    3
    Views:
    740
    Andrei
    Oct 27, 2003
  4. Nigel Wilkinson
    Replies:
    2
    Views:
    374
    Nigel Wilkinson
    Jul 25, 2005
  5. James Byrne
    Replies:
    3
    Views:
    541
    James Byrne
    Sep 14, 2010
Loading...

Share This Page