Read / Write tables across endpoints and components


Can someone educate me on how i can setup a hashtable or array so that meets the following criteria?

  • read and write to from any endpoint / compoenent

  • Private to only the logged in user. I want to make sure it’s not avaialble to all users.

  • Private to a specific page only

Right now i’m defining a hash table at the start of my page, and it’s very inconsistent as to what can or cannot access the hash table.

There isn’t a particular page specific scope. There is the $Session scope that will allow you to set data that is persisted just for the user.

What I’d recommend is to have some sort of hashtable for your page specified data.

$Session:PageData = @{
    Page1 = @{ MyData = '123' }
    Page2 = @{ MyData = '456' }
    Page3 = @{ MyData = '789' }


Then you should be able to access that page data like this.


You should be able to access this in any endpoint script block. You will not be able to access this in a top-level static page’s Content block.

New-UDPage -name 'Static' -Content {
    # Wont work here

   New-UDElement -Tag 'div' -Endpoint { 
        # Will work here

Note that in v3, all pages are dynamic so you won’t have to worry about whether or not it will work in a page or not.

ok thanks @adam!