Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "greatsamps"

Question

We are running ASP.NET Zero Angular on Nginx for an application we are about to launch. As angular is using its routing functionality, so by default, if one were to refresh the page, Nginx returns a 404 error as it can't find the routed path.

To correct this, we have added the following section to the Nginx configuration:

location / { try_files $uri $uri/ /index.html?$args; }

This is working, to the degree that if you perform a browser refresh, then the page now partially loads. The issue is that the paths for various assets are being distorted.

For example, we have a path on the site called Account/Login which is accessed like so:

http://site.name/Account/Login That page has a CSS file located within the assets folder. Normally when accessing the page completely through Angular routing (i.e. no refresh re-write), it would be located here:

http://site.name/Assets/CSS/Login.css What we are finding is that when the page is refreshed, and re-written, whilst it loads, the asset path distorts and becomes:

http://site.name/Account/Login/Assets/CSS/Login.css I suspect that this has nothing to do with Nginx and is, in fact, some configuration needed on the Angular side that will specify how the paths are referenced, but we are pretty new to Angular, so not sure where to start.

Any ideas?

We are using the ASP.NET Core & Angular template. It seems that its not possible to access the Hangfire dashboard. Is this correct?

Question

Hi,

We are using the angular ASP.NET Core solution, and at least whilst in debug mode, any errors are recorded to a log file in the App_Data folder. Is there anyway to override this behaviour? It would be much more helpful to have it sent to the console, or even a logging framework such as Serilog...

Thanks,

Hi,

I am having some real issues with this combined with MultiTenancy. I have two languages enabled at host level, english and spanish, with english being the default. I have created a TenantLevel setting for the above name pointing it to spanish (es). This works well, you can browse to the tenant and its all in spanish.

The problem occurs when creating or logging in as a user. Looking at the database settings table, each time a page is loaded for a logged in user, an entry is created in the table for the above setting, with a value of "null". Due to this setting existing, but with a value of "null", it can't resolve the language and it reverts to the host default of english.

For the sake of clarity, when i say its set to "null" i mean a string comprising of 4 letters "null" not an actual NULL value.

I have tried looking at the source code, and i can't see where it is setting this value or why. I am currently working through the code trying to figure this out, but there is clearly something not right here.

Any ideas?

Kind Regards,

Done some more digging on this, and it appears that problem is related to this method:

public override Task DetermineProviderCultureResult(HttpContext httpContext)
{
if (httpContext == null)
{
throw new ArgumentNullException(nameof(httpContext));
}

    var localizationHeader = httpContext.Request.Headers[CookieRequestCultureProvider.DefaultCookieName];

    if (localizationHeader.Count == 0)
    {
        return Task.FromResult((ProviderCultureResult) null);
    }

    return Task.FromResult(ParseHeaderValue(localizationHeader));
}

var localizationHeader = httpContext.Request.Headers[CookieRequestCultureProvider.DefaultCookieName];

This cookie does not exist on the client, but it is still returning a result, with null as the culture id.

Hi,

Wondering if you can help here. Part of our project includes a library (written by us) that communicates with 3rd party systems via Akka.NET. What we are doing is starting the library and registering a static reference to a factory class during the startup routine in ASP.NET Boilerplate. Our ApplicationServices can talk to it, as its statically referenced, which is working fine.

The problem we are facing is that this library also needs to receive messages which need to be passed to an ApplicationService. Due to DI, this will not be as straightforward as sending the messages.

Does anyone have any pointers on how to go about doing this? My initial thoughts are to pass a reference to the DI framework when the library is initially started and using that, but as DI is pretty new to me, some pointers would be much appreciated1

Hi,

I need to configure the visibility of some specific buttons on a row by row basis. For example, for some rows i might want an edit button to show, but not for others.

What we are doing is sending in the JSON two properties: CanBeEdited, CanBeDeleted, which i am then adding into the visibility definition of the button.

The problem is that it seems that the button will only show if ALL the rows have the visibility set for it, if one of them does not, then the button does not show.

Please see DataTables definition below:

var dataTable = _$affiliateGroupsTable.DataTable({
            paging: true,
            serverSide: true,
            processing: true,
            listAction: {
                ajaxFunction: _affiliateGroupsService.getAll,
            },
            columnDefs: [
                {
                    targets: 0,
                    data: "affiliateGroup.name"
                },
                {
                    targets: 1,
                    data: "affiliateGroup.id",
                    render(data, type, row, meta) {
                        return "http://" + window.location.hostname + "/?a=" + row.affiliateGroup.id;
                    }
                },
                {
                    width: 120,
                    targets: 2,
                    data: null,
                    orderable: false,
                    autoWidth: false,
                    defaultContent: '',
                    rowAction: {
                        cssClass: 'btn btn-brand dropdown-toggle',
                        text: '<i class="fa fa-cog"></i> ' + app.localize('Actions') + ' <span class="caret"></span>',
                        items: [
                            {
                                text: app.localize('Edit'),
                                visible: function (data) {
                                    debugger;
                                    return _permissions.edit && data.record.affiliateGroup.canBeEdited;
                                },
                                action: function (data) {
                                    _createOrEditModal.open({ id: data.record.affiliateGroup.id });
                                }
                            },
                            {
                                text: app.localize('Delete'),
                                visible: function (data) {
                                    return _permissions.delete && data.record.affiliateGroup.canBeDeleted;
                                },
                                action: function (data) {
                                    deleteAffiliateGroup(data.record.affiliateGroup);
                                }
                            },
                            {
                                text: app.localize('Configure Payouts'),
                                visible: function (data) {
                                    return _permissions.configurePayouts && data.record.affiliateGroup.canBeEdited;
                                },
                                action: function (data) {
                                    window.location.href =
                                        'AffiliateGroupItems/?group=' + data.record.affiliateGroup.id;
                                }
                            }
                        ]
                    }
                },
            ]
        });

Hi,

In our application, we are checking some bits that require a database lookup (duplicates etc) during the method call to the Add/Update method on the AppServices. What i am looking to do is throw a detailed validation exception if something is incorrect.

I have found this link:

<a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Validating-Data-Transfer-Objects">https://aspnetboilerplate.com/Pages/Doc ... er-Objects</a>

but it is not clear how i can get hold of the validation context from an appservice.

Please advise.

Hi,

I need to know how i can combine two data properties into a single column.

For example, the following JSON:

{"CurrencyName":"USD", "Amount":12.95}

I would like to render a single column in my table that has:

CurrencyName Amount

I presume that I need to use the render function, but have no idea how to reference the two different data elements.

Any ideas?

Question

Hi,

I am having some issues with this. What confuses me is that this has worked previously, so not sure if a recent Nuget update has broken it or not.

I have two tenants configured, the default one, and one named xxx.yyy.io

Beta.gsoc.io resolves to 127.0.0.1 in the development hostfile.

The issue is that when browsing to xxx.yyy.io I end up on the host tenant. I have tried clearing cookies etc, and no luck.

Here are the key bits of code:

public override void PreInitialize()
        {
            Configuration.MultiTenancy.IsEnabled = true;
            Configuration.Modules.AbpWebCommon().MultiTenancy.DomainFormat = "{0}";
 
            Configuration.Modules.AspNetZero().LicenseCode = _appConfiguration["AbpZeroLicenseCode"];
            Configuration.Navigation.Providers.Add<DashboardNavigationProvider>();
        }

Appsettings.json

"App": {
    "WebSiteRootAddress": "http://{TENANCY_NAME}:5000/",
    "RedirectAllowedExternalWebSites": "http://localhost:45776/"
  },

Any idea why this is no longer resolving?

Showing 1 to 9 of 9 entries