Check the docs before asking a question: https://abp.io/docs/latest
Check the samples to see the basic tasks: https://abp.io/docs/latest/samples
The exact solution to your question may have been answered before, and please first use the search on the homepage.
Provide us with the following info:
🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration
button.
1 bytes) at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker) at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first) at System.Text.Json.Utf8JsonReader.ReadSingleSegment() at System.Text.Json.JsonDocument.Parse(ReadOnlySpan
1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb& database, StackRowStack& stack)
at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedArrayPoolBytes, PooledByteBufferWriter extraPooledByteBufferWriter) at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory
1 json, JsonDocumentOptions options)
at Volo.Abp.BlazoriseUI.Components.ObjectExtending.LookupExtensionProperty2.GetLookupItemsAsync(String filter) at Volo.Abp.BlazoriseUI.Components.ObjectExtending.LookupExtensionProperty
2.SearchFilterChangedAsync(String filter)
at Volo.Abp.BlazoriseUI.Components.ObjectExtending.LookupExtensionProperty`2.OnAfterRenderAsync(Boolean firstRender)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) ObjectExtensionManager.Instance.Modules()
.ConfigureIdentity(identity =>
{
identity.ConfigureUser(user =>
{
user.AddOrUpdateProperty\<int?>(
"SupplierId",
property =>
{
property.UI.Lookup.Url = "/api/app/suppliers";
property.UI.Lookup.DisplayPropertyName = "companyName";
}
);
});
});
Create MyBlazorServerLookupApiRequestService.cs as mentioned in https://abp.io/support/questions/6195/Extension-property-in-Identity-Users-not-working-in-Azure When trying to access a modal which depends on the endpoint, you will get an null exception since HttpContext is null, remove the adding of headers according to this issue: https://abp.io/support/questions/8205/Extension-property-in-Identity-Users-not-working-in-Azure-6195 You will now get the loginpage as a result, instead of the json. How should we handle this to get access to the endpoint?
MyBlazorServerLookupApiRequestService.cs:
using System;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Abp;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Volo.Abp.AspNetCore.Components.Web.Extensibility;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.Client.Authentication;
using Volo.Abp.MultiTenancy;
namespace LansenOnline.Blazor.Services;
[Dependency(ReplaceServices = true)]
public class MyBlazorServerLookupApiRequestService : ILookupApiRequestService, ITransientDependency
{
public IHttpClientFactory HttpClientFactory { get; }
public IRemoteServiceHttpClientAuthenticator HttpClientAuthenticator { get; }
public IRemoteServiceConfigurationProvider RemoteServiceConfigurationProvider { get; }
public ICurrentTenant CurrentTenant { get; }
public IHttpContextAccessor HttpContextAccessor { get; }
public NavigationManager NavigationManager { get; }
public ILogger<MyBlazorServerLookupApiRequestService> Logger { get; }
public MyBlazorServerLookupApiRequestService(IHttpClientFactory httpClientFactory,
IRemoteServiceHttpClientAuthenticator httpClientAuthenticator,
ICurrentTenant currentTenant,
IHttpContextAccessor httpContextAccessor,
NavigationManager navigationManager,
IRemoteServiceConfigurationProvider remoteServiceConfigurationProvider,
ILogger<MyBlazorServerLookupApiRequestService> logger)
{
HttpClientFactory = httpClientFactory;
HttpClientAuthenticator = httpClientAuthenticator;
CurrentTenant = currentTenant;
HttpContextAccessor = httpContextAccessor;
NavigationManager = navigationManager;
RemoteServiceConfigurationProvider = remoteServiceConfigurationProvider;
Logger = logger;
}
public async Task<string> SendAsync(string url)
{
var client = HttpClientFactory.CreateClient();
var requestMessage = new HttpRequestMessage(HttpMethod.Get, url);
var uri = new Uri(url, UriKind.RelativeOrAbsolute);
if (!uri.IsAbsoluteUri)
{
var remoteServiceConfig = await RemoteServiceConfigurationProvider.GetConfigurationOrDefaultOrNullAsync("Default");
if (remoteServiceConfig != null)
{
// Blazor tiered mode
var baseUrl = remoteServiceConfig.BaseUrl;
client.BaseAddress = new Uri(baseUrl);
AddHeaders(requestMessage);
await HttpClientAuthenticator.Authenticate(new RemoteServiceHttpClientAuthenticateContext(client, requestMessage, new RemoteServiceConfiguration(baseUrl), string.Empty));
}
else
{
// Blazor server mode
client.BaseAddress = new Uri(NavigationManager.BaseUri);
// foreach (var header in HttpContextAccessor.HttpContext!.Request.Headers)
// {
// requestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray());
// }
}
}
var response = await client.SendAsync(requestMessage);
var responseString = await response.Content.ReadAsStringAsync();
Logger.LogInformation("Response: {0}", responseString);
return responseString;
}
protected virtual void AddHeaders(HttpRequestMessage requestMessage)
{
if (CurrentTenant.Id.HasValue)
{
requestMessage.Headers.Add(TenantResolverConsts.DefaultTenantKey, CurrentTenant.Id.Value.ToString());
}
var currentCulture = CultureInfo.CurrentUICulture.Name ?? CultureInfo.CurrentCulture.Name;
if (!currentCulture.IsNullOrEmpty())
{
requestMessage.Headers.AcceptLanguage.Add(new(currentCulture));
}
}
}
Check the docs before asking a question: https://abp.io/docs/latest
Check the samples to see the basic tasks: https://abp.io/docs/latest/samples
The exact solution to your question may have been answered before, and please first use the search on the homepage.
Provide us with the following info:
🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration
button.
Hello, we are trying to override the Account/Default.cshtml in the .Host project to customize it. We have followed the steps in the docs: https://abp.io/docs/commercial/6.0/themes/lepton-x/commercial/mvc#account-layout We are using the same code for the Default.cshtml as found when downloading the code for the LeptonX module.
The override is partially working, but we are now missing some js functionallity and the logo and background images. The background image could be found by changing the path slightly. But we cant find a solution to all the js scripts not being loaded. We suspect that the problem is with the bundling of the scripts:
<abp-script-bundle name="@LeptonXThemeBundles.Scripts.Global" />
The logs from the console when accessing the login page:
Uncaught ReferenceError: $ is not defined at ApplicationLocalizationScript?cultureName=en:3:1 at ApplicationLocalizationScript?cultureName=en:3050:3
Uncaught ReferenceError: $ is not defined at ApplicationConfigurationScript:3:1 at ApplicationConfigurationScript:313:3
Failed to load resource: the server responded with a status of 500 () ServiceProxyScript:1
Uncaught ReferenceError: $ is not defined at Login.js?_v=638693378107394850:1:1
Some js functionality is working, like the login button, but not the tenant switch of the language switch. What do we need to do to make the bundling work? Or is it another issue?