Base solution for your next web application
From Nov 21
To Dec 1
Also valid for the
existing customers!
Open Closed

Custom Session Property in Client #10675

radhikari1985 created


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
    ismcagdas created
    Support Team


    In your {ProjectName}RazorPage.cs class, you can replace AbpSession with your custom session. This is the line it is defined

    After that, you can access it in your razor pages.

  • 0
    radhikari1985 created

    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
    ismcagdas created
    Support Team

    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;