cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

How to maintain session across tabs/pages in Mashup

rajgs
1-Newbie

How to maintain session across tabs/pages in Mashup

Hi,

I am developing a Thingworx Mashup which has a login page and once logged in, pages with specific content will displayed based on the logged in user. Login authentication will be done based on database.Please let me know how to maintain login session of logged-in user across all tabs/pages in a mashup? Is there any standard method defined by ThingWorx? If so please share the related tutorial link.

 

Regards,

Raj


 

2 REPLIES 2
VladimirRosu
19-Tanzanite
(To:rajgs)

Hi Raj,
In the Mashup Composer, on the right side of page you have the Data, Session and User sections.
If
you switch to the User tab, you have the name of user and you can bind
to any control accepting String binding, or perform specific services that take this input as a parameter.

If, however, you want to make thing simpler, you can
invoke the following function in any service, in order to obtain the
currently logged user:
var userName = Resources["CurrentSessionInfo"].GetCurrentUser(); //STRING


BR,
Vladimir



adam11
5-Regular Member
(To:rajgs)

Raj,

Are you looking to display different

Mashups

 based on the current user or just user-specific content? If it's the latter, you can also use the "principal" keyword which is functionally equivalent to

GetCurrentUser()

. It's a nice shorthand that will save you some typing ; )


If it's the former, you'll need some logic in your

Mashups

 to determine which

Mashup

 should be displayed for the current user. Most likely, you'll use a

Contained Mashup

 and dynamically bind the name of a

Mashup

 depending on the current user.


Regards,

Adam



Announcements


Top Tags