abp icon indicating copy to clipboard operation
abp copied to clipboard

When I override IdentityUserController,it raise routing issues

Open abllyboy opened this issue 6 years ago • 1 comments

I want to override IdentityUserController and add my logic in methods,when I debug it raise routing issue.What should I do?Below is the screenshot: s2 s1

abllyboy avatar Dec 20 '19 03:12 abllyboy

Try

public class MyRoutingConvention : IControllerModelConvention
{
	public void Apply(ControllerModel controller)
	{
		if (controller.ControllerType == typeof(IdentityUserController))
		{
			controller.Selectors.Clear();
			foreach (var action in controller.Actions)
			{
				action.Selectors.Clear();
			}
		}
	}
}

public class MyIdentityUserController : IdentityUserController
{
	public MyIdentityUserController(IIdentityUserAppService userAppService) 
		: base(userAppService)
	{
	}
}

public override void ConfigureServices(ServiceConfigurationContext context)
{
	//...
	context.Services.Configure<MvcOptions>(options =>
	{
		options.Conventions.Add(new MyRoutingConvention());
	});
	//...
}

maliming avatar Dec 20 '19 04:12 maliming