Results 1 to 19 of 19

Thread: Download .asp files?

  1. #1

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772

    Download .asp files?

    I want to write a script that will allow the user to download .asp files, using the querystring for the file to download. Normally if you click on a link (for example, "somepage.asp"), it will display it in the browser. However, I want to write a script that allows you to download it (ex: "download.asp?file=somepage.asp"). Any idea how to do this or any links?
    Alcohol & calculus don't mix.
    Never drink & derive.

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Zip it. If your using IIS, it will always process the server side code.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  3. #3
    chenko
    Guest
    I did have a script on my site what will allow you to view the code and even edit and save, My host is being stupid at the moment so It dont work, and also I cant FTP from here at the moment, I will get it to you later if you aint already sorted it.

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Write an ASP page that sets the content type to plain text and uses the file system object to read and output the ASP file. Or if you're really ambitious, convert it to color-coded html.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  5. #5
    chenko
    Guest
    Try this i wrote

    usage..
    file.asp?path=c:\inetpub\wwwroot\index.asp

    u/n admin
    p/w password

    the path is the full server path, im not sure if a relative path will work thou. This will open a file in a textarea, and you also have the option to save the file

  6. #6
    chenko
    Guest
    File didnt attach....just change this to a .asp file.....

  7. #7
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    You could also create a directory that holds your downloadable asp files and turn off the execute permissions.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  8. #8

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    I don't think you are understanding what I mean. Take a look at this page:

    http://www.asp101.com/samples/index.asp

    If you click on "download the code" a download box comes up with the .asp file as the file to save.
    Alcohol & calculus don't mix.
    Never drink & derive.

  9. #9
    chenko
    Guest
    They probaly have them files in a non-executable folder just like monte96 said.

  10. #10

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    I dunno, maybe. If I set a folder to just "read" i get a 403.
    Alcohol & calculus don't mix.
    Never drink & derive.

  11. #11
    chenko
    Guest
    Try turning execute off, and execute scripts off as well

  12. #12

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    I did. I turned off "Execute" and "Scripts" and I get a 403 error.

    HTTP Error 403
    403.1 Forbidden: Execute Access Forbidden

    This error can be caused if you try to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.

    Please contact the Web server's administrator if the problem persists.
    Alcohol & calculus don't mix.
    Never drink & derive.

  13. #13
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Sounds like they are passing the filename to a component then..
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  14. #14
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    I think you need to just mess with the outputted mime types.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  15. #15

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Josh: I've been trying that, but I can't get anything to work. Say I am trying to save "test.asp." A download box will come up with "test.asp" in the filename field, but the type is "HTML document." When I click Save, it saves as test.asp with nothing in it. I thought maybe it was because there was only server-side script so I tried it on a HTML file...same thing.
    Alcohol & calculus don't mix.
    Never drink & derive.

  16. #16
    Lively Member
    Join Date
    May 2001
    Posts
    127
    They are just reading the file using the FSO Object then Dumping it out as a text file,

    Same as reading a text file, you can read a text file with an ASP Page.

    Just Dump the text file out to the browser. You can Dynamically create ASP pages and HTML Pages on the fly. I do it all the time. and ASP Page is nothing but a text file just read it and display it back.

  17. #17
    chenko
    Guest

    Unhappy

    ummmm, Ok guys, I think this guy is telling us about programming in ASP.....

    BOUND4DOOM: Id guess we all do ASP here mate

  18. #18

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Well, I finally figured it out, it was a combination of what JoshT and BOUND4DOOM said.
    Alcohol & calculus don't mix.
    Never drink & derive.

  19. #19
    chenko
    Guest
    Well how did you do it then?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width