Please explain the flow. We have a site thats already in Prod. We are introducing new Features daily and what them seeded into the db and drive functionality based on Feature value.
Bubbling this up again.
I would appreciate a paid service to produce a guide on how to move from ASP.NET MVC AngularJS --> ASP.NET Core Angular 7.
Thank you.
Here are two ways I use for throwing UserFriendlyException in GetLoginResultAsync:
var loginResult = await GetLoginResultAsync(loginModel.UsernameOrEmailAddress, loginModel.Password, loginModel.TenancyName,LoginCount);
throw new UserFriendlyException(L("PasswordAttempts")); throw new UserFriendlyException(L("LoginFailed"), L("InvalidUserNameOrPassword"));
In logs.txt, I can see Abp.UI.UserFriendlyException: Login failed! at Project.Web.Controllers.AccountController.<GetLoginResultAsync>d__28.MoveNext() in C:\Projects\Project.Web\Controllers\AccountController.cs:line 248
In application insights, I saw: The model item passed into the dictionary is of type 'System.Web.Mvc.HandleErrorInfo', but this dictionary requires a model item of type 'Abp.Web.Mvc.Models.ErrorViewModel'.
Forgot to mention, we're using application insights filter:
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public class AiHandleErrorAttribute : HandleErrorAttribute
{
public override void OnException(ExceptionContext filterContext)
{
if (filterContext != null && filterContext.HttpContext != null && filterContext.Exception != null)
{
//If customError is Off, then AI HTTPModule will report the exception
if (filterContext.HttpContext.IsCustomErrorEnabled)
{
var ai = new TelemetryClient();
ai.TrackException(filterContext.Exception);
}
}
}
}
Thank you
<cite>ismcagdas: </cite> Hi,
This might help <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/818#issuecomment-175117869">https://github.com/aspnetboilerplate/as ... -175117869</a>. Have you tried it with a Tenant which uses host database ?
Yeah, it's working for users in host database but not tenant users.. Finally I resolved it with the combination of EventBus and Signalr (Register the Signalr client in layout.js so that the logout event could always be triggered for the target user no matter which page the target user is on). Thank you!
We separate our host database and tenant databases. And tenant users only exists in their own tenant databases. Would that cause the UserManager not able to find any user so that identityvalidation all fail and log out all users?
Error logging to post to AI would be really useful.
<a class="postlink" href="https://docs.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics">https://docs.microsoft.com/en-us/azure/ ... ts-metrics</a>
<cite>alper: </cite> Afak if you make a database transaction in a different thread, db context can be disposed whenever the request ends.
Try to make a new scope in the background thread to use the db context there. You're introducing a race condition since the original db context might be disposed before your task runs.
Thank you very much for the quick reply. Yeah, I was thinking of that possible reason so I directly pass UserId and the OrgUnitId to eventBus, and in there I initialize a new UserManager to update/insert records..
EventBus.Trigger(new UserOrganizationUnitsUpdateDto { UserId = user.Id, OrganizationUnitIds = input.GrantedOrganizationUnits });
Would doing that still have the race condition issue?
I want to force the user to logout. So that he cannot log in back!
I got it worked now. We are using angular mvc
I used this in UserManager.cs
this.UserValidator = new UserValidator<User, long>(this)
{
AllowOnlyAlphanumericUserNames = false
};
<cite>aaron: </cite>
The hub context is different from the context used by abp's signalr hub context so the event is not associated to the event handler at client side.
That's the same as how Abp.Web.SignalR's SignalRRealTimeNotifier gets CommonHub:
private static IHubContext CommonHub { get { return GlobalHost.ConnectionManager.GetHubContext<AbpCommonHub>(); } }
I finally removed the EventBus backplane and directly call the event handler method from front end... now it works as they will definitely share the same hub context. Thank you Aaron.