Solution before upgrade:
Use MyAbpValidationActionFilter
to replace the build-in AbpValidationActionFilter
.
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.Validation;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Reflection;
using Volo.Abp.Validation;
namespace MyCompanyName.MyProjectName.Web
{
public class MyAbpValidationActionFilter : IAsyncActionFilter, ITransientDependency
{
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
if (!context.ActionDescriptor.IsControllerAction() ||
!context.ActionDescriptor.HasObjectResult())
{
await next();
return;
}
if (ReflectionHelper.GetSingleAttributeOfMemberOrDeclaringTypeOrDefault<DisableValidationAttribute>(context.ActionDescriptor.GetMethodInfo()) != null)
{
await next();
return;
}
if (ReflectionHelper.GetSingleAttributeOfMemberOrDeclaringTypeOrDefault<DisableValidationAttribute>(context.Controller.GetType()) != null)
{
await next();
return;
}
if (context.ActionDescriptor.GetMethodInfo().DeclaringType != context.Controller.GetType())
{
var baseMethod = context.ActionDescriptor.GetMethodInfo();
var overrideMethod = context.Controller.GetType().GetMethods().FirstOrDefault(x =>
x.DeclaringType == context.Controller.GetType() &&
x.Name == baseMethod.Name &&
x.ReturnType == baseMethod.ReturnType &&
x.GetParameters().Select(p => p.ToString()).SequenceEqual(baseMethod.GetParameters().Select(p => p.ToString())));
if (overrideMethod != null)
{
if (ReflectionHelper.GetSingleAttributeOfMemberOrDeclaringTypeOrDefault<DisableValidationAttribute>(overrideMethod) != null)
{
await next();
return;
}
}
}
context.HttpContext.RequestServices.GetRequiredService<IModelStateValidator>().Validate(context.ModelState);
await next();
}
}
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
PostConfigure<MvcOptions>(mvcOptions =>
{
mvcOptions.Filters.ReplaceOne(
x => (x as ServiceFilterAttribute)?.ServiceType == typeof(AbpValidationActionFilter),
new ServiceFilterAttribute(typeof(MyAbpValidationActionFilter)));
});
}
hi
Those code are unnecessary. the email module will get the configuration automatically.
https://docs.abp.io/en/abp/latest/Emailing
This is test program, You can use it to confirm your email setting is correct.
https://github.com/abpframework/abp-samples/blob/master/EmailSendDemo/src/EmailSendDemo/Program.cs#L11
You can inject the ICurrentUser service and use IsAuthenticated to check the user whatever is logged.
hi
You can give it a try. I think it will be works.
Like your example website, it automatically jumps to the login page.
The demo website is angular. You are using Blazor Server.
Please confirm your email config is correct.
https://github.com/abpframework/abp-samples/blob/master/EmailSendDemo/src/EmailSendDemo/Program.cs#L11
HI
Please use this demo to check your mail config.
https://github.com/abpframework/abp-samples/tree/master/EmailSendDemo
hi
Check your xxxDomainModule. It will use NullEmailSender in DEBUG mode.
#if DEBUG
context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, NullEmailSender>());
#endif
hi
Have you tried using NavigationManager
in Index
page?
I do notice that we don’t have any backend tables for permission/localization master data. So how we can manage the permission for remote/client applications which out of side Identity Manager.
Please use code to manage the permission. Because the application may use the cache, manually change the data will not refresh the cache.
This is issue for us critical as of now. We have tried uncheck the client application level, that is not also working. Please help us ASAP. On top of all setting options not saving from UI. If changed from DB it is not showing until I re-cycle the application pool.
This may be because the cache is not refreshed, refer to the previous answer and change the settings through the code.