Getting the message “Your session has expired!” in the Angular Designer

Stimulsoft Reports.ANGULAR discussion
Post Reply
christianmurata
Posts: 9
Joined: Fri Jul 26, 2024 12:19 pm

Getting the message “Your session has expired!” in the Angular Designer

Post by christianmurata »

Hello,

When I try to take any action in the designer I get the message “Your session has expired!”. At some times it is possible to perform the action, at others the message is returned.

Our team is using the stimulsoft-designer-angular component for online report editing.

These are the versions used:
stimulsoft-designer-angular@2024.3.5
Stimulsoft.Reports.Angular.NetCore@2024.3.5

This is how I configure the designer to display a blank report.

Code: Select all

[Route("api/[controller]")]
public class DesignerController : Controller
{        
    [HttpGet]
    public IActionResult Get(string lang, string data)
    {
        var requestParams = StiAngularDesigner.GetRequestParams(this);
        if (requestParams.Action == StiAction.Undefined)
        {
            var options = new StiAngularDesignerOptions();
            options.Height = Unit.Percentage(100);
            options.Dictionary.PermissionDataConnections = StiDesignerPermissions.None;
            options.Dictionary.PermissionDataSources = StiDesignerPermissions.View;
            options.Dictionary.PermissionDataRelations = StiDesignerPermissions.View;
            options.Appearance.Zoom = StiZoomMode.PageWidth;

            options.Localization = lang switch
            {
                "es" => "Localization/es.xml",
                "en" => "Localization/en.xml",
                _ => "Localization/pt-BR.xml"
            };
            return StiAngularDesigner.DesignerDataResult(requestParams, options);
        }
        return StiAngularDesigner.ProcessRequestResult(this);
    }

    [HttpPost]
    public async Task<IActionResult> Post()
    {
        var requestParams = StiAngularDesigner.GetRequestParams(this);
        if (requestParams.ComponentType == StiComponentType.Designer)
            switch (requestParams.Action)
            {
                case StiAction.GetReport: return await GetReport();
                //case StiAction.SaveReport: return await SaveReport(identifier, reqData);
            }
        return StiAngularDesigner.ProcessRequestResult(this);
    }

    public async Task<IActionResult> GetReport()
    {
        var report = StiReport.CreateNewReport();
        return StiAngularDesigner.GetReportResult(this, report);
    }
}
Attachments
session_expired.png
session_expired.png (214.5 KiB) Viewed 1673 times
Vadim
Posts: 393
Joined: Tue Apr 23, 2013 11:23 am

Re: Getting the message “Your session has expired!” in the Angular Designer

Post by Vadim »

Hello

Please make sure that you add controller with views service
services.AddControllersWithViews()
christianmurata
Posts: 9
Joined: Fri Jul 26, 2024 12:19 pm

Re: Getting the message “Your session has expired!” in the Angular Designer

Post by christianmurata »

Hello,

I've already added the service, but still not working.

This is how I configure my app in Program.cs:

Code: Select all

using Reports.StimulsoftDesigner.Filters;
using Reports.StimulsoftDesigner.Util;

var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddEnvironmentVariables();
builder.Services.AddControllersWithViews();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddMemoryCache();
builder.Services.AddSession();
builder.Services.AddMvc();
builder.Services.AddSwaggerGen();
builder.Services.AddScoped<ValidateTokenMiddleware>();
builder.Services.AddCors(o => o.AddPolicy("AllowOrigin", builder => {
    builder.AllowAnyOrigin()
           .AllowAnyMethod()
           .AllowAnyHeader()
           .WithExposedHeaders("Content-Disposition");
}));

Keys.SetIssuer(builder.Configuration.GetValue<string>("IdentityServer:Issuer"));
Keys.SetAppGroup(builder.Configuration.GetValue<string>("IdentityServer:AppGroup"));

Stimulsoft.Base.StiLicense.Key = "";

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}
else
{
    app.UseExceptionHandler("/Home/Error");
    app.UseHsts();
}

app.UseDefaultFiles();
app.UseStaticFiles();
app.UseCors("AllowOrigin");
app.UseRouting();
app.UseMiddleware<ValidateTokenMiddleware>();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllerRoute(name: "default", pattern: "{controller=Values}/{action=Index}/{id?}");
app.Run();
Vadim
Posts: 393
Joined: Tue Apr 23, 2013 11:23 am

Re: Getting the message “Your session has expired!” in the Angular Designer

Post by Vadim »

Hello

Can you create simple project to reproduce problem & send it to us?
christianmurata
Posts: 9
Joined: Fri Jul 26, 2024 12:19 pm

Re: Getting the message “Your session has expired!” in the Angular Designer

Post by christianmurata »

Hello,

I'll check out the possibility of creating it.

An important point is that the message only appears in our production environment. We have three environments, two test environments and one production environment.

In the production environment (where the problem occurs) we publish to a kubernetes container with dotnet running on a debian 12 image.

In this case, do I need to configure anything else? I'm using the default cache mode.
Lech Kulikowski
Posts: 6830
Joined: Tue Mar 20, 2018 5:34 am

Re: Getting the message “Your session has expired!” in the Angular Designer

Post by Lech Kulikowski »

Hello,

We require more time to investigate the issue thoroughly. Rest assured, we will keep you informed about the outcome as soon as possible.

Thank you.
#15781
christianmurata
Posts: 9
Joined: Fri Jul 26, 2024 12:19 pm

Re: Getting the message “Your session has expired!” in the Angular Designer

Post by christianmurata »

Hello,

Thank you for your support.

The problem occurred because there were two instances of the API configured to receive requests randomly. We reduced it to one and it worked normally.

In the future we'll look into how to use multiple instances of the API.
Lech Kulikowski
Posts: 6830
Joined: Tue Mar 20, 2018 5:34 am

Re: Getting the message “Your session has expired!” in the Angular Designer

Post by Lech Kulikowski »

Hello,

Thank you for the information.
Post Reply