Activities of "Priyanka"

Hi,

Could you explain it in detail? thanks

using this code, it is not redirecting to login page, I want if new session is active in new browser, then the previous browser's application should redirect to login page.

if (httpContext.User.Identity != null && httpContext.User.Identity.AuthenticationType == "Identity.Application")
                    {
                        await httpContext.RequestServices.GetRequiredService<AbpSignInManager>().SignOutAsync();
                        await httpContext.ChallengeAsync("Identity.Application");
                    }

                    //JWT
                    if (httpContext.User.Identity != null && httpContext.User.Identity.AuthenticationType == "AuthenticationTypes.Federation")
                    {
                        await httpContext.ChallengeAsync(JwtBearerDefaults.AuthenticationScheme);
                    }

hi

You can't get user info in the LoggedOutModel class. so you can't output a username to security logs.

so, can we say that it's not possible to update username in log table for logout action?

Yes, you can do that in the LoggedOutModel class

If we can, then could you please help how can we?

sorry, you can't do that in the LoggedOutModel class

Ok, thanks for your support.

Hi,

So, preventing concurrent logins from different browsers is working now but the previous browser did not redirect to the login page

You can redirect:

if (httpContext.User.Identity != null && httpContext.User.Identity.AuthenticationType == "Identity.Application") 
{ 
    await httpContext.RequestServices.GetRequiredService<AbpSignInManager>().SignOutAsync(); 
    //await httpContext.ChallengeAsync("Identity.Application"); 
     
    var redirectUrl = "..."; 
    httpContext.Response.Redirect(redirectUrl); 
    return; 
} 

I tried this but it is stuck in infinite loop, it is redirecting to login and somehow it is coming again on this condition, condition is satisfied and redirecting again and this whole process is keep going.

sure, but what is the difference between both, as per my understanding we can call LoggedOutModel after overriding.

why don't you configure a serilog sink to db? and just call Logger.LogError or something?

We have requirement to keep log in DB. While Inserting in DBlog table I'm getting the same exception which I want to log in DB table.

i meant something like this here;

https://github.com/serilog-mssql/serilog-sinks-mssqlserver

does that work for you?

Log event is already there, we have case where our service is called by external user so we are keeping log of that service where we need to keep request message, response message, current status, messageId etc and this table data is accessible to user to know the status of request hence we are keeping in separate table. Please help me with the solution to insert data in my log table without any exception of try block transaction.

Hi,

you need to roll back the main transaction, and create a new transaction to record the log.

try 
{ 
   await _repositpry.InsertAsync(...xxxx, autoSave: true) 
} 
catch(exception e) 
{ 
   await _unitOfWorkManager.Current.RollbackAsync(); 
} 
final 
{ 
  using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true)) 
  {  
       ..... 
        
       await uow.CommitAsync(); 
  } 
} 

Hi, Thank you for the solution but uow.CommitAsync() is having compile time error

Can we use CompleteAsync? What is the difference between commit and complete here in this case ?

Sorry, should be CompleteAsync. (because there is no IDE code prompt here)

ok, thank you for the solution. It is working.

Showing 11 to 20 of 116 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on November 11, 2025, 06:29
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.