I have the following code in my OnPost
of a page where i am throwing a new UserFriendlyException
public virtual async Task<IActionResult> OnPostAsync()
{
var tenant = await TenantRepository.FindByNameAsync(Tenant.Name);
if (tenant != null)
{
throw new UserFriendlyException(message: "Tenant Name already exists please choose another");
}
However the page go to a 403 Forbidden page and not shows a popup dialog, can you let me know what I am doing wrong
Yes that works
no thats not it still same result
I am trying to have a validate confirm password input with password input, please see below code
I am getting the Validation Error come up twice please see below screen shot.
can you please suggest why i am getting the error twice?
public virtual async Task<IActionResult> OnPostAsync()
{
ValidateModel();
var input = ObjectMapper.Map<TenantInfoModel, SaasTenantCreateDto>(Tenant);
await TenantRegistrationAppService.RegisterTenantAsync( new RegisterTenantInputDto { SaasTenantCreateDto = input });
return NoContent();
}
public class TenantInfoModel : ExtensibleObject, IValidatableObject
{
[Required]
[StringLength(TenantConsts.MaxNameLength)]
public string Name { get; set; }
[SelectItems(nameof(EditionsComboboxItems))]
public Guid? EditionId { get; set; }
[Required]
[EmailAddress]
[StringLength(256)]
public string AdminEmailAddress { get; set; }
[Required]
[DataType(DataType.Password)]
[StringLength(128)]
[DisableAuditing]
public string AdminPassword { get; set; }
[Required]
[DataType(DataType.Password)]
[StringLength(128)]
[DisableAuditing]
public string ConfirmAdminPassword { get; set; }
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (!AdminPassword.Equals(ConfirmAdminPassword , StringComparison.Ordinal))
{
yield return new ValidationResult(
"The passwords do not match!",
new[] { "AdminPassword", "ConfirmAdminPassword" }
);
}
base.Validate(validationContext);
}
}
When i create any Entity with simple properties i am getting the folowing
Error occurred on DB migration step: MSBUILD : error MSB1009: Project file does not exist. Switch: ../*.HttpApi.Host Unable to retrieve project metadata. Ensure it's an MSBuild-based .NET Core project. If you're using custom BaseIntermediateOutputPath or MSBuildProjectExtensionsPath values, Use the --msbuildprojectextensionspath option.
I am using MVC Template which is not tiered so there is no *".HttpApi.Host Folder" in my solution
This error was due to the Email password not being encrypted so i canned it to my DOmain project in ConfigureService and set it as a Gloabal setting
Thanks you are right i needed to verify the phone number and it works
You are right learnabp is a developer so can manage the organisation
I was logging in with the owner account hence the problem ... i logged in as a developer and it worked
Thanks for your help
Thanks for you response, i have copied the code over to my own web application