Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Variable & storing

    Hello

    I have an application, Login page, enter UserName &
    Password.
    Function in Users called GetUserDetails and checks the
    details and if they are valid calls a function to fill
    the following in the class component called

    Public Class UserDetails
    Public UserID As Integer
    Public UserName As String
    Public FullName As String
    Public Email As String
    End Class

    So I would have thought now that what ever page I goto
    that I could retreive the email or fullname from the
    class above without having the call the GetUserDetails.

    I use the following code.

    'Load the User Name textbox
    Dim userDetails As New
    ASPNET.ASSETREGISTER.UserDetails()
    msgfullname.Text = " Logged In: " &
    userDetails.FullName

    But it does not fill it, any ideas?
    thanks in advance
    yop Guest

  2. Similar Questions and Discussions

    1. storing and changing an external variable
      Hello... Sorry for this question, but I am trying something new to me. I need to hold a couple of variables in an outside file that can be...
    2. Storing value from XML into a variable
      There is a combo-box by the name "cbJobs" and it gets its value from the XML file named "data.xml".. I want to store the value transferred from this...
    3. Storing link text to a Cookie or Session Variable
      Another one of those "It sounds easy enough to do, but...." I need to store the value/text displayed as a hyperlink to either a Cookie or Session...
    4. storing quotes into a variable
      I think you just have to escape every double quote that you want to be a part of the HTML code like this --> /" That should work. I dont think...
    5. [PHP] storing quotes into a variable
      $perf_mod = '<a href="#" onclick="popWindow(\'popup.php\')'; using \ to escape the ' \ escapes special characters. See the manual. Regards ...
  3. #2

    Default Re: Variable & storing

    Once you fill the object, where are you storing it? In session? Serialized
    to disk? Not at all?

    Since you are simply creating a group of properties/fields a struct might be
    a better option, but you still have to store it:

    Dim MyClass As UserDetails = new UserDetails()
    'lines to fill class here
    Session("MyClass") = MyClass

    To use:
    Dim MyClass as UserDetails = CType(Session("MyClass"), MyClass)

    You could make a static class to hold the variables, but you could only have
    one user at a time. Then, your code would work without saving the object
    off.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    Author: ADO.NET and XML: ASP.NET on the Edge

    ************************************************** **************************
    ****
    Think Outside the Box!
    ************************************************** **************************
    ****
    "yop" <aidangill@oceanfree.net> wrote in message
    news:065101c35287$2bb01b10$a601280a@phx.gbl...
    > Hello
    >
    > I have an application, Login page, enter UserName &
    > Password.
    > Function in Users called GetUserDetails and checks the
    > details and if they are valid calls a function to fill
    > the following in the class component called
    >
    > Public Class UserDetails
    > Public UserID As Integer
    > Public UserName As String
    > Public FullName As String
    > Public Email As String
    > End Class
    >
    > So I would have thought now that what ever page I goto
    > that I could retreive the email or fullname from the
    > class above without having the call the GetUserDetails.
    >
    > I use the following code.
    >
    > 'Load the User Name textbox
    > Dim userDetails As New
    > ASPNET.ASSETREGISTER.UserDetails()
    > msgfullname.Text = " Logged In: " &
    > userDetails.FullName
    >
    > But it does not fill it, any ideas?
    > thanks in advance

    Cowboy \(Gregory A. Beamer\) Guest

  4. #3

    Default Re: Variable & storing

    Ok to be honest I am not sure where they are stored, in
    the class.
    The class is not been stored in the session. I do not
    realise that you could to be honest

    thanks

    >-----Original Message-----
    >Once you fill the object, where are you storing it? In
    session? Serialized
    >to disk? Not at all?
    >
    >Since you are simply creating a group of
    properties/fields a struct might be
    >a better option, but you still have to store it:
    >
    >Dim MyClass As UserDetails = new UserDetails()
    >'lines to fill class here
    >Session("MyClass") = MyClass
    >
    >To use:
    >Dim MyClass as UserDetails = CType(Session("MyClass"),
    MyClass)
    >
    >You could make a static class to hold the variables, but
    you could only have
    >one user at a time. Then, your code would work without
    saving the object
    >off.
    >
    >--
    >Gregory A. Beamer
    >MVP; MCP: +I, SE, SD, DBA
    >Author: ADO.NET and XML: ASP.NET on the Edge
    >
    >************************************************* ********
    *******************
    >****
    >Think Outside the Box!
    >************************************************* ********
    *******************
    >****
    >"yop" <aidangill@oceanfree.net> wrote in message
    >news:065101c35287$2bb01b10$a601280a@phx.gbl...
    >> Hello
    >>
    >> I have an application, Login page, enter UserName &
    >> Password.
    >> Function in Users called GetUserDetails and checks the
    >> details and if they are valid calls a function to fill
    >> the following in the class component called
    >>
    >> Public Class UserDetails
    >> Public UserID As Integer
    >> Public UserName As String
    >> Public FullName As String
    >> Public Email As String
    >> End Class
    >>
    >> So I would have thought now that what ever page I goto
    >> that I could retreive the email or fullname from the
    >> class above without having the call the GetUserDetails.
    >>
    >> I use the following code.
    >>
    >> 'Load the User Name textbox
    >> Dim userDetails As New
    >> ASPNET.ASSETREGISTER.UserDetails()
    >> msgfullname.Text = " Logged In: " &
    >> userDetails.FullName
    >>
    >> But it does not fill it, any ideas?
    >> thanks in advance
    >
    >
    >.
    >
    yop Guest

  5. #4

    Default Re: Variable & storing

    When you load a class, it goes out of scope as soon as the page finishes
    processing. If you try to pull that class on another page, it has no values,
    as it is a new instance.

    If you want to use an object across multiple pages, you need to store it
    somewhere. Using Session is the easiest method, but you can serialize the
    object and create your own engine, if there is some reason session is
    unusable. Recreating the wheel is a pain, however, so I would stick to
    Session before rewriting the mechanism.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    Author: ADO.NET and XML: ASP.NET on the Edge

    ************************************************** **************************
    ****
    Think Outside the Box!
    ************************************************** **************************
    ****
    "yop" <aidangill@oceanfree.net> wrote in message
    news:0bc201c352b8$ab1eac00$a301280a@phx.gbl...
    > Ok to be honest I am not sure where they are stored, in
    > the class.
    > The class is not been stored in the session. I do not
    > realise that you could to be honest
    >
    > thanks
    >
    >
    > >-----Original Message-----
    > >Once you fill the object, where are you storing it? In
    > session? Serialized
    > >to disk? Not at all?
    > >
    > >Since you are simply creating a group of
    > properties/fields a struct might be
    > >a better option, but you still have to store it:
    > >
    > >Dim MyClass As UserDetails = new UserDetails()
    > >'lines to fill class here
    > >Session("MyClass") = MyClass
    > >
    > >To use:
    > >Dim MyClass as UserDetails = CType(Session("MyClass"),
    > MyClass)
    > >
    > >You could make a static class to hold the variables, but
    > you could only have
    > >one user at a time. Then, your code would work without
    > saving the object
    > >off.
    > >
    > >--
    > >Gregory A. Beamer
    > >MVP; MCP: +I, SE, SD, DBA
    > >Author: ADO.NET and XML: ASP.NET on the Edge
    > >
    > >************************************************* ********
    > *******************
    > >****
    > >Think Outside the Box!
    > >************************************************* ********
    > *******************
    > >****
    > >"yop" <aidangill@oceanfree.net> wrote in message
    > >news:065101c35287$2bb01b10$a601280a@phx.gbl...
    > >> Hello
    > >>
    > >> I have an application, Login page, enter UserName &
    > >> Password.
    > >> Function in Users called GetUserDetails and checks the
    > >> details and if they are valid calls a function to fill
    > >> the following in the class component called
    > >>
    > >> Public Class UserDetails
    > >> Public UserID As Integer
    > >> Public UserName As String
    > >> Public FullName As String
    > >> Public Email As String
    > >> End Class
    > >>
    > >> So I would have thought now that what ever page I goto
    > >> that I could retreive the email or fullname from the
    > >> class above without having the call the GetUserDetails.
    > >>
    > >> I use the following code.
    > >>
    > >> 'Load the User Name textbox
    > >> Dim userDetails As New
    > >> ASPNET.ASSETREGISTER.UserDetails()
    > >> msgfullname.Text = " Logged In: " &
    > >> userDetails.FullName
    > >>
    > >> But it does not fill it, any ideas?
    > >> thanks in advance
    > >
    > >
    > >.
    > >

    Cowboy \(Gregory A. Beamer\) Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139