Prerequisites
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
- What is your product version?
- ASP NET Boilerplate
- What is your product type (Angular or MVC)?
- MVC
- What is product framework type (.net framework or .net core)?
- .NET CORE
If issue related with ABP Framework
- 5.14.0
How do I get the custom Property that I added in the Server Side using ClaimsAbpSession, but trying to find out how can we get this in client side like: abp.session.newPropertyName, so it can be access by the client when needed just like other session properties.
3 Answer(s)
-
0
Hi,
In your {ProjectName}RazorPage.cs class, you can replace
AbpSession
with your custom session. This is the line it is defined https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Mvc/Views/AbpZeroTemplateRazorPage.cs#L18.After that, you can access it in your razor pages.
-
0
i have already taken these steps and was able to get them in the Server side. however i am not able to get them accessed in the client side abp.session.mynewpropertyName.
just like abp.session.userId
-
0
Hi @radhikari1985
You can set a JS variable on the main _Layout.cshtml file liek below;
window.mynewpropertyName = @"YourSession.MynewpropertyName";
Then, you need to create a new JS file and set it as shown below;
abp.session.mynewpropertyName = abp.session.mynewpropertyName || window.mynewpropertyName;