Page 1 of 2 12 LastLast
Results 1 to 15 of 22

Thread: Tornado - Parameter Passing to other ASPX files

  1. #1
    Join Date
    Dec 2002
    Location
    Albany, NY
    Posts
    115

    Tornado - Parameter Passing to other ASPX files

    How are parameters, or exported data fields passed to other ASPX files?

    Our tornado program is using a tabbed page with login. On successful login, data from the password table is exported. This exported data will be used in other ASPX files within the tabbed file.

    An example would be nice...

    Paul

  2. #2
    Join Date
    Oct 2002
    Posts
    933
    A safe way to do that is to store the var in a session variable and then retrieve from the other aspx file. We must have covered this numerous times in examples.

    If the applications are in serial (same app) then use the export fields and columns to do that. Export fields and columns (raw also) is not trival and the above techique is not easy to apply an dyou have to use the export functions in Tornado.

    FK

  3. #3
    Join Date
    Jul 2004
    Posts
    39
    Frank,

    We'd love to know where these examples are. We've scoured the forum looking for something on session variables, but nothing really on how to use them.

    We would like to avoid hard coding variables on URLs because our variables change depending on who logs in to the application.

    We understand that you have to put the variable into a session variable, but we have yet to see how to pull the session variable from another ASPX file.

    Also, how do we actually know if it is stuffing the variable into a session variable? We can test it using the same aspx file, but that doesn't really solve the issue, because we need the variable to be GLOBAL in a sense.

    Let me know if this made sense at all.

    Thanks again
    JM

  4. #4
    Join Date
    Oct 2002
    Posts
    933
    Session Var are "Global" to the session. Master slave examples are everywhere. Selecetd items, exports, master/details...


    FK

  5. #5
    Join Date
    Dec 2002
    Location
    Albany, NY
    Posts
    115
    Frank,

    We are working on a very complex and involved application which requires Session variable passing to other .aspx files. Both John and I have worked on this issue all day and really need your help here.

    Please direct us to the examples showing the use of Session variables with multi applications.

    Also, have you found the solution for the login to muliple applications through a tabbed form?

    thanks, Paul

  6. #6
    Join Date
    Oct 2002
    Posts
    933
    How complicted SV passing can be ?
    Ask John to explain the problem to me or you can try it here.

    I thought I send yout the files for the tab aspx login

    maintest.aspx
    =============

    <script language='vb' runat='server'>
    Sub Page_Load(Source as Object, E as EventArgs)

    Dim X As New tornado.z()
    Dim GD as New Tornado.Getdata()
    Dim LstClick as string = GD.Get_LastClick

    X.dbQP = "U=1|S=1|PS=-1|TH=Ti= Main Test File"

    Dim login as string = ""
    login = "Type=db|DSN=Password.mdb|SQL=SELECT password,"
    login = login & "email FROM table1 WHERE ID = '[[ID]]'|"
    login = login & "LoginTitle=Login|FromAddr=support@aspdb.com|"
    login = login & "EmailSubject=Your Password|"
    login = login & "EmailBody=Your password/id is : [[LoginID]]/[[password]]"
    X.dbLogin = login

    Dim mp1 as string = ""
    mp1 = "type=3|style=17|"
    mp1 = mp1 & "FirstPage=http://localhost/tornado/scratch/test1.aspx|"
    mp1 = mp1 & "mw=600| mh=20| dw=900| dh=600| Ta=center"
    X.dbMenuParams = mp1

    Dim md1 as string = ""
    md1 = "la=First Test File|"
    md1 = md1 & "u=http://localhost/tornado/scratch/test1.aspx,"
    md1 = md1 & "la=Second Test File|"
    md1 = md1 & "u=http://localhost/tornado/scratch/test2.aspx"
    X.dbMenuData = md1

    Response.Write("<Center> &nbsp" & x.ASPdbMenu() & "</center><BR>")

    End Sub
    </script>

    test1
    =====
    <script language='vb' runat='server'>
    Sub Page_Load(Source as Object, E as EventArgs)

    Dim X As New tornado.z()
    Dim GD as New Tornado.Getdata()
    Dim LstClick as string = GD.Get_LastClick

    X.dbQP = "U=1|Q=Products|s=4|D=Nwind|PS=-1|TH=Ti= Test File 1"

    Dim login as string = ""
    login = "Type=db|DSN=Password.mdb|SQL=SELECT password,"
    login = login & "email FROM table1 WHERE ID = '[[ID]]'|"
    login = login & "LoginTitle=Login|FromAddr=support@aspdb.com|"
    login = login & "EmailSubject=Your Password|"
    login = login & "EmailBody=Your password/id is : [[LoginID]]/[[password]]"
    X.dbLogin = login
    X.ASPdbNET()
    End Sub
    </script>


    test2
    =====
    <script language='vb' runat='server'>
    Sub Page_Load(Source as Object, E as EventArgs)

    Dim X As New tornado.z()
    Dim GD as New Tornado.Getdata()
    Dim LstClick as string = GD.Get_LastClick
    X.dbQP = "U=1|Q=employees|s=2|D=Nwind|NI=b5|PS=-1|TH=Ti= Test File 2"

    Dim login as string = ""
    login = "Type=db|D=Password.mdb|SQL=SELECT password,"
    login = login & "email FROM table1 WHERE ID = '[[ID]]'|"
    login = login & "LoginTitle=Login|FromAddr=support@aspdb.com|"
    login = login & "EmailSubject=Your Password|"
    login = login & "EmailBody=Your password/id is : [[LoginID]]/[[password]]"
    X.dbLogin = login

    X.ASPdbNET()
    End Sub
    </script>

  7. #7
    Join Date
    Jul 2004
    Posts
    39
    Ok, as you probably know by now, we have a main login, then after you are logged in, there is a main page with 2 tabbed .aspx files.

    When each user logs on, we pull their department number according to their username (ex. John Smith is from Department 6)

    So we would like to use this department number for each .aspx file. We are trying to put the number into a session variable, then pull it back up when you click on either of the tabbed windows.

    So, say John Smith from Department 6 successfully logs in, then when he clicks on the 1st tabbed window (or 2nd tabbed window), only the data pertaining to his department number should show up.

    Hope this isn't too confusing...
    JM

  8. #8
    Join Date
    Oct 2002
    Posts
    933
    OK,, where is the problem? Note that you are talking a possible Application Variable. If that is the case then store that as Application variable. So ALL aspx files can use it.


    FK

  9. #9
    Join Date
    Oct 2002
    Posts
    933
    >>...Both John and I have worked on this issue all day and really need your help here.


    I think this John is not John Crombe but instead, your programmer - right ???

    A bit mix up becasue if our support cannot solve that, that'll be a challenge !!! For SV, it should be pretty simple.


    FK

  10. #10
    Join Date
    Oct 2002
    Posts
    93
    Hi Paul, John here...

    It sounds like you just want to pass data from one page (a login page for example) to other pages (like the tabbed pages) that the user will click on, right?

    To do this, you just store the data into a session variable and then retrieve it from your other pages.

    Here it is in simple form...

    Login page contains:
    Session("MySavedVar") = "abc123"

    Future page contains:
    someval = Session("MySavedVar")

    Now you will see the variable someval contains "abc123". In fact, all pages the user accesses from then on can get that value out of Session("MySavedVar") whenever they wish. You can even "re-write" that value by just using the same code as the Login Page shows above.

    Session variables are in effect "Global" variables FOR EACH USER and DURING THEIR CURRENT SESSION. This sounds like what you want because when John Smith logs in, you want to look up and remember once that he's in department 6 and then use that value from then on. Just store that in a session variable i.e. Session("dept") = 6 (except that the value "6" here would be replaced by some value that you read from the database probably.

    Hope this answers your question. If not, please clarify. Remember, we can also consult with you on an hourly basis to write some code snippets for you to get you going.

    Take care,
    John

  11. #11
    Join Date
    Dec 2002
    Location
    Albany, NY
    Posts
    115
    Frank and John,

    Thanks for your input on all this.

    Here's where we are now. Saving Session Variables does work but only if you launch a second application while the browser is open. And, that's normal behavior. However, we are saving SV's then launching a second .aspx file using .ASPDBMenu and that's where the problem is. It appears that the SV's are timing out because the call to .ASPdbMenu is closing the browser session thus wiping out the SV's.

    We tested this theory using VB.NET and it works fine. Please check this out as we can't continue without the ability to pass SV's.....

    AS for the Logout button. Your solution is to code the .dbLogin on each .aspx file. Isn't there a global solution which would work with .ASPdbMenu (eg tabbed page)? Without a global solution, my users will need to login and out every time a tab is pressed. That's not a solution.

    Also, John Mooney is working with me in the development of this system. Don't be confused by that.

    Finally, if need be, feel free to give me a call as I'll be glad to help iron this out with you....Paul

  12. #12
    Join Date
    Oct 2002
    Posts
    933
    In that case, use the Application variable. It'll stay there.

    FK

  13. #13
    Join Date
    Dec 2002
    Location
    Albany, NY
    Posts
    115
    Frank,

    I just tried the application variable as you suggested,and the behavior is the same as the session variable. It;s getting wiped out during the redirect to the second .aspx file.

    Anyother suggestions?

  14. #14
    Join Date
    Dec 2002
    Location
    Albany, NY
    Posts
    115
    Frank,

    I believe the .dbMenuData, which redirects the application to another page is problematic when using SV's. In other words, SV's won't work with a tabbed page (.dbMenuParams).

    Here's what I'm thinking. If you issue a response.redirect (which is what I believe .dbMenudata is using, then you'll never get a SV to stay around. This is because you need to use a full URL with the u=parameter in .dbMenuData. Which closes the session and opens a new browser.

    I tested this theory using the server.transfer method of ASP.NET, which only requires a .aspx file name, no full URL. And the SV's we're able to be called by the second .aspx file.

    Paul

  15. #15
    Join Date
    Oct 2002
    Posts
    933
    does not sound right. look at the following code - both session and application var works. Go from here and modify the code to illustrate the problem.

    FK


    maintest123.aspx
    ================
    <script language='vb' runat='server'>
    Sub Page_Load(Source as Object, E as EventArgs)
    Application("CommonVar") = "Frank"
    Session("CommonVar") = "Kwong"
    Dim X As New tornado.z()
    Dim mp1 as string = ""
    mp1 = "type=3|style=17|"
    mp1 = mp1 & "FirstPage=http://localhost/tornado/scratch/test111.aspx|"
    mp1 = mp1 & "mw=600| mh=20| dw=900| dh=600| Ta=center"
    X.dbMenuParams = mp1

    Dim md1 as string = ""
    md1 = "la=First Test File|"
    md1 = md1 & "u=http://localhost/tornado/scratch/test111.aspx,"
    md1 = md1 & "la=Second Test File|"
    md1 = md1 & "u=http://localhost/tornado/scratch/test222.aspx"
    X.dbMenuData = md1
    Response.Write("<Center> &nbsp" & x.ASPdbMenu() & "</center><BR>")
    End Sub
    </script>


    test111.aspx
    ============
    <script language='vb' runat='server'>
    Sub Page_Load(Source as Object, E as EventArgs)
    Dim X As New tornado.z()
    X.dbQP = "U=1|Q=Products|s=4|D=Nwind|gdf=0,1|TH=Ti= Test File 1"
    X.ASPdbNET()
    response.write("<P> Application Common Variable = " & Application("CommonVar"))
    response.write("<P> Session Common Variable = " & Session("CommonVar"))
    End Sub
    </script>

    test222.aspx
    ============
    <script language='vb' runat='server'>
    Sub Page_Load(Source as Object, E as EventArgs)
    Dim X As New tornado.z()
    X.dbQP = "U=2|Q=employees|s=2|D=Nwind|NI=b5|gdf=0,1|TH= Ti= Test File 2"
    X.ASPdbNET()
    response.write("<P> Application Common Variable = " & Application("CommonVar"))
    response.write("<P> Session Common Variable = " & Session("CommonVar"))
    End Sub
    </script>


Posting Permissions

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