I am not able to use UserFriendlyException from Account controller it doesnt give me expected pop up message Please help
4 Answer(s)
-
0
Please share some code.
-
0
Hi, please share your the code for the method where UserFriendlyException is thrown.
Also, Ajax response for the method as well.
-
0
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
-
0
does it work as expected when you disable Application Insights?