B4J Question Can't get an event with download2

Discussion in 'B4J Questions' started by schimanski, Jun 26, 2015.

  1. schimanski

    schimanski Well-Known Member Licensed User

    When I download a file from my server, i don't get an handler-result. I don't know, how I can read out the parameters, when I download a file such as

    Code:
    Kontaktstempel.Download2(ServerPfad & "/Kontakte/Kontaktstempel.eis"Array As String("type""download""passwort""1234"))
    When I upload, I can check the parameter in the

    Code:
    Sub Handle(req As ServletRequest, resp As ServletResponse)
    But it is not possible to to this after a download request...
     
  2. derez

    derez Expert Licensed User

    What I do (and there may be other ways) - I have an index file in my static folder, which directs to a download handler with the password entered by the user. In the handler module I check the passwod parameter.

    index file:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <html xmlns=
    "http://www.w3.org/1999/xhtml">
    <head>
    <link rel=
    "stylesheet" type="text/css" href="index.css" />
    <title>Dudu Files - login</title>
    <script src=
    "http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
    </head>
    <body>

    <
    form name="input" action="http://[my duckdns]:XXXXX/download" method="get">
    Password: <input 
    type="text" name="Password" value="">
    <br><br><br><br><br>
    <input 
    type="submit" value="Submit">
    </
    form>
    </body>
    </html>
    handler:
    Code:
    Sub Handle(req As ServletRequest, resp As ServletResponse)
        
    Dim sb As StringBuilder
        sb.Initialize
        
    If req.GetParameter("Password") <> "YYYYYYYY" Then
            sb.Append(
    "<br/><h1> Wrong Password ! </h1>")
            resp.Write(sb.ToString)
            
    Return
        
    End If
     
  3. schimanski

    schimanski Well-Known Member Licensed User

    Thanks for your solution..I will try it...seems to be tricky:D
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice