Page 1 of 1

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

Posted: Wed Oct 09, 2024 1:32 pm
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);
    }
}

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

Posted: Thu Oct 10, 2024 6:10 am
by Vadim
Hello

Please make sure that you add controller with views service
services.AddControllersWithViews()

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

Posted: Thu Oct 10, 2024 11:36 am
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();

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

Posted: Thu Oct 10, 2024 2:08 pm
by Vadim
Hello

Can you create simple project to reproduce problem & send it to us?

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

Posted: Wed Oct 16, 2024 4:34 pm
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.

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

Posted: Fri Oct 18, 2024 8:03 am
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

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

Posted: Thu Oct 24, 2024 1:16 pm
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.

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

Posted: Fri Oct 25, 2024 7:32 am
by Lech Kulikowski
Hello,

Thank you for the information.