Note that there are some explanatory texts on larger screens.

plurals
  1. POA custom variable that is user-specific
    primarykey
    data
    text
    <p>I'm trying to wrap my head around this, but I just can't.</p> <p>Let's say I have a class called custom. I have a variable in it called User_ID, which I use to retrieve a user's session (so I don't have to keep calling the session variable over and over again). Something like this:</p> <pre><code>Public Class custom Public Shared User_ID as integer Public Shared sub GatherUserID() User_ID = Session ("user_ID") end sub end class </code></pre> <p>Yes, it's a very simple example, but it gets my point across. I've done things similar to this in classic ASP (using includes, not classes) and the User_ID would be unique to whomever was accessing the page in question at that time.</p> <p>For some reason, and this is what I don't understand, when I use custom.User_ID in a custom class, it's shared for <strong>everyone</strong>. That's what I don't want. What I want is to be able to use a variable like that and keep it user-specific. I see the advantage to sharing variables across classes (e.g. database connection strings), but I don't see how to set up a custom variable in a custom class that I can use just for that user without having to constantly call Sessions.</p> <p>I see that I can declare it as a Property as opposed to a shared variable, but I really don't know what exactly that is intended to accomplish, and no one seems to have a clear explanation. Is a Property user/session-specific? Will it solve my specific problem as a result? This is what I don't get.</p> <p><strong>EDIT</strong>: just to clarify, the user_ID in this example is something I intend to use in several spots that get called during the creation of a page (e.g. the master file, the page itself, various classes.) Hence the reason for the creation of a custom variable.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload