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 have a service where I'm doing Insert and update in Mutiple table and in case of any exception, I'm logging in DB log table in finally section. I'm getting this exception in Insert or update "String or binary data would be truncated in table 'Addresses', column 'Street'. Truncated value: 'Severe depressive episode without psychotic symptoms, not specified as arising in the postnatal peri' , now when I'm logging the error in DB log table, on insert of log table I'm getting the same exception. My Log method for DB log have attribute- [UnitOfWork(IsDisabled = true)], seems like on log insert it is trying to complete the whole transaction, how to resolve this?
ABP Framework version: v5.3.2
UI Type:React
Database System: EF Core (SQL Server)
Tiered (for MVC) or Auth Server Separated (for Angular): yes
Exception message and full stack trace:NA
Steps to reproduce the issue: Call Insert where some exception is there and in Finally call insert to log the exception in logTable.
sure, but what is the difference between both, as per my understanding we can call LoggedOutModel after overriding.
What is the difference if we call below mention functions: await httpContext.RequestServices.GetRequiredService<AbpSignInManager>().SignOutAsync(); await httpContext.RequestServices.GetRequiredService<LoggedOutModel>().OnGetAsync();
ABP Framework version: v5.3.2
UI Type:React
Database System: EF Core (SQL Server)
Tiered (for MVC) or Auth Server Separated (for Angular): yes
Exception message and full stack trace:NA
Steps to reproduce the issue: Login and Logout
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.
sorry, you can't do that in the LoggedOutModel class
Ok, thanks for your support.
Yes, you can do that in the
LoggedOutModel
class
If we can, then could you please help how can we?
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?
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
We have output the log on
LogoutModel
. Why you are overriding theLoggedOutModel
?
I'm overriding as before logout, I need to call ADFS logout as well so first I'm redirecting to logout from third party than calling ABP's logout. With ABP's method, I am able to save the userid and action in my log table but username is not updating.