Question about DLL in ASP

Discussion in 'ASP General' started by Fie Fie Niles, Aug 13, 2004.

  1. I was given the following scenario, and would like to confirm what the
    correct answer will be.

    Say you have 3 ASP pages, on each page the user needs to complete
    information.
    Page 1: first name and last name.
    When user click the "next" button, go to Page 2. The ASP page calls a VB DLL
    (say Process.DLL) to enter the information for first name and last name.
    Page 2: address
    When user click the "next" button, go to Page 3. The ASP page calls a VB DLL
    (say Process.DLL) to enter the information for address.
    Page 3: age
    When user click the "save" button, you need to save the information entered
    on page 1, 2 and 3 into a database.

    The question is: by the time you are on the 3rd page, will the data from
    Page 1 and 2 still in the Process.DLL ?

    In my opinion, instead of calling the DLL on Page 1 and 2, use Session
    variables to store the first name, last name and address from Page 1 and 2.
    When you get to Page 3, pass the Session variable to the Process.DLL.
    Usually when I call a DLL (Set oProcess =
    server.CreateObject("ProcessObject.clsA"), before I exit this ASP page, I
    will set the oProcess variable to nothing (set oProcess = nothing). I read
    that passing an object like oProcess in a Session variable is not a good
    idea.
    So, when I get to Page 2, oProcess will be a new instance again, thus the
    information from Page 1 won't be there anymore.

    Would you please give me your opinion on this. Is the method to call the DLL
    on each page a better idea, and will you get all info from Page 1 and 2 by
    the time you are on Page 3, or using the Session Variable to store the first
    name, last name and address from Page 1 and 2 is a better idea ?

    Thank you.
    Fie Fie Niles, Aug 13, 2004
    #1
    1. Advertising

  2. You have to perisist the data somewhere.
    DLLS cant keep them in memory and Session variables
    are not the right choice.

    Save them to the database while the user saves every page.
    Use a flag to denote whether the entry is completed, or use an auxilary
    table which can be cleared periodically.

    --
    Roji. P. Thomas
    Net Asset Management
    https://www.netassetmanagement.com


    "Fie Fie Niles" <> wrote in message
    news:OxZO%...
    > I was given the following scenario, and would like to confirm what the
    > correct answer will be.
    >
    > Say you have 3 ASP pages, on each page the user needs to complete
    > information.
    > Page 1: first name and last name.
    > When user click the "next" button, go to Page 2. The ASP page calls a VB

    DLL
    > (say Process.DLL) to enter the information for first name and last name.
    > Page 2: address
    > When user click the "next" button, go to Page 3. The ASP page calls a VB

    DLL
    > (say Process.DLL) to enter the information for address.
    > Page 3: age
    > When user click the "save" button, you need to save the information

    entered
    > on page 1, 2 and 3 into a database.
    >
    > The question is: by the time you are on the 3rd page, will the data from
    > Page 1 and 2 still in the Process.DLL ?
    >
    > In my opinion, instead of calling the DLL on Page 1 and 2, use Session
    > variables to store the first name, last name and address from Page 1 and

    2.
    > When you get to Page 3, pass the Session variable to the Process.DLL.
    > Usually when I call a DLL (Set oProcess =
    > server.CreateObject("ProcessObject.clsA"), before I exit this ASP page, I
    > will set the oProcess variable to nothing (set oProcess = nothing). I read
    > that passing an object like oProcess in a Session variable is not a good
    > idea.
    > So, when I get to Page 2, oProcess will be a new instance again, thus the
    > information from Page 1 won't be there anymore.
    >
    > Would you please give me your opinion on this. Is the method to call the

    DLL
    > on each page a better idea, and will you get all info from Page 1 and 2 by
    > the time you are on Page 3, or using the Session Variable to store the

    first
    > name, last name and address from Page 1 and 2 is a better idea ?
    >
    > Thank you.
    >
    >
    Roji. P. Thomas, Aug 14, 2004
    #2
    1. Advertising

  3. Fie Fie Niles

    John Guest

    You can also transfert the variables from the 1° to the 2° page and store
    them in HIDDEN FIELDS

    Response.Write "<INPUT TYPE=""HIDDEN"" VALUE=" & Chr(34) &
    Request.QueryString("FirstName") & Chr(34) & " NAME=""Firstname"">
    John, Aug 14, 2004
    #3
  4. Fie Fie Niles

    fniles Guest

    Thanks.
    May I know why using Session variable is not a good idea ?

    Also, would you please confirm that passing object variable (like
    oProcess from Process.dll) in a session is not a good idea, and that it
    is better before I exit the ASP page, to set the oProcess variable to
    nothing (set oProcess = nothing) ?

    Thank you

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    fniles, Aug 14, 2004
    #4
  5. Fie Fie Niles

    fniles Guest

    Thank you.
    Passing the variable in the hidden field is a good idea.

    Would you please confirm that it is not a good idea to pass an object
    variable (like oProcess from Process.dll) in a session variable, and it
    is better before I exit the ASP page, to set the oProcess variable to
    nothing (set oProcess = nothing) ?

    Thanks.



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    fniles, Aug 14, 2004
    #5
  6. fniles wrote:
    > Thank you.
    > Passing the variable in the hidden field is a good idea.
    >
    > Would you please confirm that it is not a good idea to pass an object
    > variable (like oProcess from Process.dll) in a session variable,


    http://blogs.msdn.com/ericlippert/archive/2003/09/18/53050.aspx

    > and
    > it is better before I exit the ASP page, to set the oProcess variable
    > to nothing (set oProcess = nothing) ?
    >

    That's more controversial:
    http://blogs.msdn.com/ericlippert/archive/2004/04/28/122259.aspx

    With ADO objects, it is still my practice to explicitly close and destroy
    them in the proper order, since they involve child objects (child objects
    need to be released before the poarent objects that created them). With more
    well-behaved objects, unless they take up a lot of resources/memory (in
    which case they be destroyed as soon as you are finished with them), you can
    allow the automatic cleanup to take care of them.

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Aug 14, 2004
    #6
  7. http://msdn.microsoft.com/library/default.asp?URL=/library/en-us/dnasp/html/ASPtips.asp

    --
    Roji. P. Thomas
    Net Asset Management
    https://www.netassetmanagement.com


    "fniles" <> wrote in message
    news:u$...
    > Thanks.
    > May I know why using Session variable is not a good idea ?
    >
    > Also, would you please confirm that passing object variable (like
    > oProcess from Process.dll) in a session is not a good idea, and that it
    > is better before I exit the ASP page, to set the oProcess variable to
    > nothing (set oProcess = nothing) ?
    >
    > Thank you
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Roji. P. Thomas, Aug 16, 2004
    #7
    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. Anushi
    Replies:
    5
    Views:
    8,626
  2. Weston Fryatt
    Replies:
    2
    Views:
    947
    Weston Fryatt
    Jan 1, 2005
  3. NGM
    Replies:
    0
    Views:
    2,285
  4. Dave
    Replies:
    0
    Views:
    101
  5. H. Simpson
    Replies:
    4
    Views:
    244
    H. Simpson
    Aug 3, 2004
Loading...

Share This Page