conditional download

  • 17 years ago

    Hi,
    I want to allow my users to download some files, but only if they fit a condition (they are register for example). Does anybody know how to do this?
    Thanks

  • 17 years ago

    try to search in vbip.com

  • 17 years ago

    Tkx,  I've figured out myself how to do that

  • 17 years ago

    store the file in a database, not just in a directory on the server. then you can only execute the database query if they meet the requirements


    (or is that what you'd figured out?)

  • 17 years ago

    I don't store files in database, I pass the filename as parameter to an asp file where I do all the job.


    My problem is now how to start automaticaly the download process if the user has the proper right?

  • 17 years ago

    humph, okay, but the database method would be easier, faster, more secure, etc. etc.



    starting the download's easy.... i'll assume you pass it as a query string for the sake of this code, but a session variable could, of course, be used. just put the url of the file in the meta tags


    then it'll automatically be the equivilant of downloading the file.



    ... but i dont understand your verification purposes??? where is the file stored on the server? in a directory where anyone can type the url and get it? or in another folder outside of PUBLIC_HTML and then copy it into a directory and then delete afterwards? (crap method)


    any more questions and i'll be glad to help

  • 17 years ago

    Yes, you're right, but users can't see the url before they meet some conditions and it' enought for now; I will use the database storage later, it's a good idea.


    Do you know any mysql provider for asp?

  • 17 years ago

    well, i dont use ASP any more cos it's an inferior language


    but you can connect to MySQL from ASP, here's some code (haven't checked it so dont shoot me if it doesnt work )


    StrIP=Request.ServerVariables("SERVER_NAME")


    MyServerDataBase="db_myDatabase;"


    dbUser="uid=myUserName;"
    dbPassword="pwd=MyPassword;"
    strForConnection_GL = "DRIVER={mySQL};" & _
    "Server=" & StrIP & _
    ";Port=3306;" & _
    "Option=131072;" & _
    "Stmt=;" & _
    "Database=" & MyServerDataBase & _
    ";Uid=root;" & _
    "Pwd=;"


    DbDSN=strForConnection_GL
    set conn = server.CreateObject("ADODB.Connection")
    set rs = server.CreateObject("ADODB.Recordset")
    conn.Open DBDSN
    rs.ActiveConnection = conn
    if conn.errors.count <> 0 then
    response.write "Error!"
    end if

  • 17 years ago

    Thank you, I'll try

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“XML is like violence - if it's not working for you, you're not using enough of it.”