Can you please reply us ? what should we do ?
Are you talking about Zero? --> Yes
What is your product version? --> 4.0
What is your product type (Angular or MVC)? --> MVC
What is product framework type (.net framework or .net core)? --> .net core
Or is it a free startup template for ABP? --> No it is not free startup it is paid.
For reproducing that issue we need to enable multitenancy. Could you please create one Tenant for this demo so we can test on that Tenant.
Thanks.
1)LoadStop.Web.MVC\Areas\App\Views\Shared\Components\AppDefaultBrand\Default.chtml
We have one "AppLogo" img tag with following src attribute on above page: src="@headerViewModel.GetLogoUrl(ApplicationPath, UiThemeCustomizer.IsTopMenuUsed || UiThemeCustomizer.IsTabMenuUsed ? UiThemeCustomizer.HeaderSkin: UiThemeCustomizer.LeftAsideAsideSkin)"
2)LoadStop.Web.MVC\Areas\App\Models\Layout\HeaderViewModel.cs
public string GetLogoUrl(string appPath, string menuSkin) { if (LoginInformations?.Tenant?.LogoId == null) { return appPath + $"Common/Images/app-logo-on-{menuSkin}.png"; }
//id parameter is used to prevent caching only.
return appPath + "TenantCustomization/GetLogo?id=" + LoginInformations.Tenant.LogoId;
}
3)LoadStop.Web.Core\Controllers\TenantCustomizationController.cs
[AllowAnonymous] public async Task<ActionResult> GetLogo() {
try
{
var tenant = await _tenantManager.GetByIdAsync(AbpSession.GetTenantId());
if (!tenant.HasLogo())
{
return StatusCode((int)HttpStatusCode.NotFound);
}
var logoObject = await _binaryObjectManager.GetOrNullAsync(tenant.LogoId.Value);
if (logoObject == null)
{
return StatusCode((int)HttpStatusCode.NotFound);
}
return File(logoObject.Bytes, tenant.LogoFileType);
}
catch (System.Exception ex)
{
Logger.Error("Catch-Exception in GetLogo: " + ex.Message);
throw;
}
}
==========================================================================================
For our system, 3rd method "GetLogo" gets called and but AbpSession.GetTenantId()=null so it throws catch exception as per below: https://forum.aspnetboilerplate.com/viewtopic.php?p=21747
Above issue is same as my issue.
You can reproduce this issue on any of multi-tenancy enabled asp.net zero demo project where you can upload custom logo by tenant login and see that logo is being displayed on top left corner of header or not.
Could you please show me how can i override INavigationManager and use isvisible property with session variable ?
@ismcagdas
If you are not able to reproduce issue then can you try by hosting your test application on Azure server? as we are facing issue only on live server.
/=====================AppNotificationNames.cs========================/
/=====================.xml file========================/
<!-- Notification Definition -->
<text name="NewDocumentCreatedNotificationDefinition" value="On Document creation"></text>
<!-- Notification Message -->
<text name="NewDocumentCreatedNotificationMessage" value="New Document - New Document {documentName} type of {documentCategory} - {documentType} is created for {entity} with Expiration {ExpirationDate} by {createdByUser}"></text>
/=====================AppNotificationProvider.cs========================/
/* Document create */ context.Manager.Add( new NotificationDefinition( AppNotificationNames.NewDocumentCreated, displayName: L("NewDocumentCreatedNotificationDefinition"), permissionDependency: new SimplePermissionDependency(AppPermissions.Pages_Documents_Create) ) );
/==============================NotificationAppService.cs==============================/
public async Task<GetNotificationSettingsOutput> GetNotificationSettings() { var output = new GetNotificationSettingsOutput();
output.ReceiveNotifications = await SettingManager.GetSettingValueAsync<bool>(NotificationSettingNames.ReceiveNotifications);
var notificationDefinitions = (await _notificationDefinitionManager.GetAllAvailableAsync(AbpSession.ToUserIdentifier()));
output.Notifications = ObjectMapper.Map<List<NotificationSubscriptionWithDisplayNameDto>>(notificationDefinitions);
var subscribedNotifications = (await _notificationSubscriptionManager
.GetSubscribedNotificationsAsync(AbpSession.ToUserIdentifier()))
.Select(ns => ns.NotificationName)
.ToList();
output.Notifications.ForEach(n => n.IsSubscribed = subscribedNotifications.Contains(n.Name));
return output;
}
public async Task UpdateNotificationSettings(UpdateNotificationSettingsInput input) { await SettingManager.ChangeSettingForUserAsync(AbpSession.ToUserIdentifier(), NotificationSettingNames.ReceiveNotifications, input.ReceiveNotifications.ToString());
foreach (var notification in input.Notifications)
{
if (notification.IsSubscribed)
{
await _notificationSubscriptionManager.SubscribeAsync(AbpSession.ToUserIdentifier(), notification.Name);
}
else
{
await _notificationSubscriptionManager.UnsubscribeAsync(AbpSession.ToUserIdentifier(), notification.Name);
}
}
}
/==============================documentAppservice.cs==============================/
[AbpAuthorize(AppPermissions.Pages_Documents_Create)] private async Task<CreateOrEditDocumentDto> Create(CreateOrEditDocumentDto input) { var document = ObjectMapper.Map<Document>(input); await _documentRepository.InsertAsync(document); await UnitOfWorkManager.Current.SaveChangesAsync();
var createOrEditDocumentDto = ObjectMapper.Map<CreateOrEditDocumentDto>(document);
/*Send Document Created Notification to all subscribed users*/
await _appNotifier.NewDocumentCreatedAsync(await GetCurrentUserAsync(), GetDtoForDocumentCreatedNotification(EntityTypeEnums.Document,createOrEditDocumentDto, documentTypedata.Name));
}
/==============================AppNotifier.cs==============================/
/Send Notification for Document Create event/ public async Task NewDocumentCreatedAsync(User createdByUser, NotificationForNewDocumentCreatedDto notificationForNewDocumentCreatedDto) { try { /Set Notification data for dynamic localization string and set parameters for Notification message text/ var notificationData = new LocalizableMessageNotificationData( new LocalizableString( "NewDocumentCreatedNotificationMessage", LoadStopConsts.LocalizationSourceName ) );
notificationData["documentName"] = notificationForNewDocumentCreatedDto.CreateOrEditDocumentDto.Name;
notificationData["createdByUser"] = createdByUser.FullName;
//Write logs
Logger.Info("New document Publish Notification Start: " + notificationForNewDocumentCreatedDto.CreateOrEditDocumentDto.Name);
await _notificationPublisher.PublishAsync(AppNotificationNames.NewDocumentCreated, notificationData, null,
NotificationSeverity.Info, null, excludedUserIds: new[] { createdByUser.ToUserIdentifier() });
Logger.Info("New document Publish Notification End: " + notificationForNewDocumentCreatedDto.CreateOrEditDocumentDto.Name);
}
catch (Exception ex)
{
var errorMessage = ex.Message;
}
}
@ismcagdas Please check this comment https://support.aspnetzero.com/QA/Questions/6390#answer-45564aa4-85ff-cb00-d268-39ebc8f5015e in same thread for code.