Base solution for your next web application

Activities of "jeromevoxteneo"

Hello,

For performance reason, we would like to compress the content of the Post request on a mobile app that call our api.

To do so, we compress the json serialization of the parameter of the post method as following:

byte[] jsonBytes = Encoding.UTF8.GetBytes(json);
MemoryStream ms = new MemoryStream();
using (GZipStream gzipStream = new GZipStream(ms, CompressionMode.Compress, true))
{
    gzipStream.Write(jsonBytes, 0, jsonBytes.Length);                   
}
ms.Position = 0;
StreamContent content = new StreamContent(ms);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
content.Headers.ContentEncoding.Add("gzip");

In response of the Post, we receive an error 500 with an Abp Validation error has content.

How could we configure or override the server to accept the gzip content ?

We have tried with a module to add, at Context_BeginRequest, a filter to decompress the content if the it is gzip has following, but without result. (The filter is applied, but it doesn’t help)

string requestEncoding = ctx.Request.Headers["Content-encoding"];
if (requestEncoding != null && requestEncoding == "gzip")
{
    app.Request.Filter =
         new System.IO.Compression.GZipStream(app.Request.Filter, CompressionMode.Decompress);
}

Thanks

Hello,

I was expecting that using aspnet zero with social login, the user didn't have the needs of choosing a password but that's not the case.

Actually when I click on Facebook icon, I'm redirected to Account/ExternalLoginCallback where I have my firstname, lastname and email prefilled and I need to provide a password.

Is there an option or something to activate to make this flow simpler:

Register with social login should logged in the user without asking to define a password.

Regards,

Hello,

Is it possible to configure the max length of the exception stored on the audit logs?

Thank's

Question

Hello,

I use the aspnet zero MVC JQuery template.

Actually I have a big issue. User is allow to enter html inside of an input of type text like "test <script>alert('test')</script>". With the actual code to make an ajax call from jtable the html is not encoded.

So my website is not XSS safed.

Did I miss something ?

I tried on a not modified version of the product aspnet zero and I don't have issued there. What should I check to make this issue out of my website ?

I use jtable to display custom localized entry like that:

name: {
                    title: app.localize('Name'),
                    width: '10%',
                    display: function (data) {
                            return app.localize(data.record.nameKey);
                    }
                },

NameKey is the key matching with the table AbpLanguageTexts

That's works fine until I want to change the value from my popup. When i click on save, the jtable is reloaded but the value returned by app.localize is still the previous value and not the updated one.

I was wondering if there is a way in the framework to force a refresh of the app.localize without the need to reload the whole page ? Or maybe a way to update one value of the object for the key that is updated?

Thanks,

Hello,

I have trouble in my code actually and for example when the user set a wrong password the login method in AccountController throw a UserFriendlyException that's work fine.

But I don't get the right error message in the popup. I put some console.log in js file and it seems that the problem is :

.fail(function (jqXHR) {
                    console.log('fail ajax', jqXHR);
                    if (jqXHR.responseJSON && jqXHR.responseJSON.__abp) {
                        abp.ajax.handleResponse(jqXHR.responseJSON, userOptions, $dfd, jqXHR);
                    } else {
                        abp.ajax.handleNonAbpErrorResponse(jqXHR, userOptions, $dfd);
                    }
                });

there is no responseJSON but responseText

In preview I get the right error:

Login failed!

Description : Une exception non gérée s'est produite au moment de l'exécution de la requête Web actuelle. Contrôlez la trace de la pile pour plus d'informations sur l'erreur et son origine dans le code. 

Détails de l'exception: Abp.UI.UserFriendlyException: Login failed!

Erreur source: 


Ligne 224 :                    return loginResult;
Ligne 225 :                default:
Ligne 226 :                    throw _abpLoginResultTypeHelper.CreateExceptionForFailedLoginAttempt(loginResult.Result, usernameOrEmailAddress, tenancyName);
Ligne 227 :            }
Ligne 228 :        }

Fichier source : C:\projects\dotnet-abpzero-iexpertise\iExpertise.Web\Controllers\AccountController.cs    Ligne : 226

I don't know where is my mistake, I don't change the code that call the login action:

abp.ui.setBusy(
                null,
                abp.ajax({
                    contentType: app.consts.contentTypes.formUrlencoded,
                    url: $loginForm.attr('action'),
                    data: $loginForm.serialize()
                })
            );

I just check in last version of aspnet zero template and all works fine. Only my code failed :(

Do you have idea why I get this behavior ?

Hello,

I'm trying to make my custom attribute that extend DisplayNameAttribute to make it localized. But I cannot get the value from the languageTextManager nor from the localizationManager.

Here is my attribute for LocalizedDisplayName

using System;
using System.ComponentModel;
using System.Globalization;
using Abp.Dependency;
using Abp.Localization;
using Abp.Runtime.Session;

namespace iExpertise.Localization
{
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = false)]
    public class LocalizedDisplayNameAttribute : DisplayNameAttribute
    {
        private IApplicationLanguageTextManager _languageTextManager;
        private ILocalizationManager _localizationManager;
        //private IAbpSession _abpSession;
        private string _originalName;
        public LocalizedDisplayNameAttribute(string displayName)
            : base()
        {
            _originalName = displayName;
        }

        public override string DisplayName
        {
            get
            {
                if (_languageTextManager == null)
                {
                    _languageTextManager = IocManager.Instance.Resolve<IApplicationLanguageTextManager>();
                    _localizationManager = IocManager.Instance.Resolve<ILocalizationManager>();
                    //_abpSession = IocManager.Instance.Resolve<IAbpSession>();
                }
                var translation = _localizationManager.GetString(iExpertiseConsts.LocalizationSourceName,
                    _originalName);
                var translation2 = _languageTextManager.GetStringOrNull(null, iExpertiseConsts.LocalizationSourceName,
                    CultureInfo.CurrentCulture, _originalName);
                return translation;
            }
        }
    }
}

I put a breakpoint at the return translation and it results that: translation is [Task type id_Label] translation2 is null

I wanted to be sure that my key that was added in the xml file was ok, so I navigated to the languages list and see my entry and put a breakpoint inside of the EditTextModal of LanguagesController, the translation here is ok.

In PreInitialize method of Core module I have:

//Add/remove localization sources
            Configuration.Localization.Sources.Add(
                new DictionaryBasedLocalizationSource(
                    iExpertiseConsts.LocalizationSourceName,
                    new XmlEmbeddedFileLocalizationDictionaryProvider(
                        Assembly.GetExecutingAssembly(),
                        "iExpertise.Localization.iExpertise"
                        )
                    )
                );

I cannot understand why my localization is ok in LanguagesController and not in my custom attribute in Core project.

Thanks for help

Showing 1 to 7 of 7 entries