Base solution for your next web application

Activities of "maharatha"

https://github.com/aspnetzero/aspnet-zero-core/issues/5156

We are using Angular and .Net core latest version.

We are using Okta as our Login Provider for OpenID connect and we are able to successfully use it as well.

When the authentication is complete we get redirected to the Login page, and the login page is displayed for 2-3 seconds to the user before it logins to the system. This is creating confusion as people are thinking nothing happened let me try again.

How do we block the UI while the authentication is being verified in the back ground.

We tried adding start and stop spinner at NgInit level and that didn't help.

We also added here :  
 externalLogin(provider: ExternalLoginProvider) {
        this.showMainSpinner();
        if (this.loginService.authenticateModel.userNameOrEmailAddress) {
            this.loginService.externalAuthenticate(provider);
        }
        this.hideMainSpinner();
    }

Please help us to block the UI before the user is able to login to the application

Can I get some update on this ?

I am currently trying to integrate Devexpress reporting. I have the latest version of Angular & .NetCore Abpzero.

I was able to integrate successfully and was able to pass tokens as well.

Issue : 1

I was testing the Authorization by adding Authorize attribute like the below :

one at the Controller :

[AbpMvcAuthorize(AppPermissions.Pages_Tenants)]
public class CustomWebDocumentViewerController(IWebDocumentViewerMvcControllerService controllerService) : WebDocumentViewerController(controllerService), ITransientDependency
{

The other one at the report level :

 [AbpMvcAuthorize(AppPermissions.Pages_Tenants)]
 public partial class SampleReport : DevExpress.XtraReports.UI.XtraReport

If I don't pass a token, it throws an error which tells me it respects the Authentication.

But when i remove the Page_Tenants permission and try to access the report from Angular app, I am still able to access the report.

So it tells me the Authorization piece is not working or i have not implemented properly. I even tried with AbpAuthorize with the permission on the SampleReport class as well and that didn't work either.

Issue : 2

I have created an App Service called

public class HostOrganizationUnitReportingAppService : DocuManageAppServiceBase, IHostOrganizationUnitReportingAppService
{
    public async Task<OrganizationTenantReport> GetOrganizationTenantReport(OrganizationTenantReportInputDto input)
    {
        return new OrganizationTenantReport(1,"aa",4);
    }
}

How do I use this as Data Source for my report?

Answer

I am working on it

Answer

Sorry its Angular and NET 7.0 v12.2.0.

Its getting displayed in the UI

Question

Currently we are using the latest version of AspnetZero Angular version.

I enable time zones functionality in my application by adding following line of code to ONEWebCoreModule.cs

Clock.Provider = ClockProviders.Utc;

After adding the above line of code when I select any date in a calendar control inside my application, it picks the previous day's date. For example if I select 11/20/2023 on calendar it will show 11/19/2023.

Do we know whats going on here ?

We are using latest version of Angular and .NET Core. I have a question on how to handle the user friendly exception.

In the API when we throw user friendly exception the message is being displayed using Sweet Alert. However we want to change that behavior and handle displaying the error message on our own.

We still want to wrap the rsult but handle the error on our side.

I read the article where it says "You may want to disable displaying the message for a particular AJAX call. If so, add abpHandleError: false into the abp.ajax options.". I am not sure how to send this option as all requests are being handled by the service proxies

We use the latest version of Angular and .NET Core.

We have a requirement where is we have to display the number of users and number of users in each role for each tenant in the Tenant List. This could be an expensive operation, so we want to add this column to existing Tenant Grid however asynchronously load these columns.

Could you recommend some good approach on how to do it ?

I am using the latest version of AspnetZero Angular & Core.

We are trying implement resiliency pattern Poly as suggested by Microsoft in the below article https://learn.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/implement-http-call-retries-exponential-backoff-polly

Everything works as normal however we are having issue with logging. We want to use Abp Logger to log any retries.

Below is the sample code . If you look at the comment we want to use Abp Logger, but this code is in the start up class. So any ideas how we can use Abp Logger. The idea is to log any retry that happens for future record keeping

services.AddHttpClient<XYZManager>(httpClient =>
            {
                httpClient.BaseAddress = new Uri(_appConfiguration["URL"]);
                httpClient.DefaultRequestHeaders.Add("User-Agent", XYZ");
                httpClient.DefaultRequestHeaders.Accept.Add(
                    new MediaTypeWithQualityHeaderValue("application/json"));
                httpClient.DefaultRequestHeaders.CacheControl = CacheControlHeaderValue.Parse("no-cache");
            })
                .AddHttpMessageHandler<AuthenticationDelegationAHandler>()
                .SetHandlerLifetime(TimeSpan.FromMinutes(5))  //Set lifetime to five minutes
                .AddPolicyHandler(GetRetryPolicy())
                
static IAsyncPolicy<HttpResponseMessage> GetRetryPolicy(int medianFirstRetryDelay = 35, int retryCount = 7)
        {
           
          
            var delay = Backoff.DecorrelatedJitterBackoffV2(medianFirstRetryDelay: TimeSpan.FromMilliseconds(medianFirstRetryDelay), retryCount: retryCount);

            //Add OnTryAsync to see when the policy is executed

            
            // return HttpPolicyExtensions along with retry logger
            return HttpPolicyExtensions
                .HandleTransientHttpError()
                .OrResult(msg => msg.StatusCode == System.Net.HttpStatusCode.NotFound)
                .WaitAndRetryAsync(delay, (result, timeSpan, retryCount, context) =>
                {
                    // this is your new callback
                    // do whatever logging you want here
                    // you probably want to log the url and the response
                    // as well as the exception that was thrown
                    // but we'll leave that to you
                    Console.WriteLine($"Retry {retryCount} after {timeSpan.TotalMilliseconds}ms delay due to {result.Exception?.Message}");
                  

                    // Use Abp Logger to log the exception
                   
                  
                   
                    
                });


        }
Showing 1 to 10 of 326 entries