1

Resolved

Error in test of cookieEnabled option

description

HI,

It seems there is an error in your source code in the middleware Invoke method when checking if the use of cookie is enabled or not before retrieving the culture. You are checking if url culture path is enabled instead of if cookie is enabled.

You use the folowwing code:
public override async Task Invoke(IOwinContext context)
        {
            string urlLanguage = options.CulturePathEnabled ? getPathLanguage(context) : null;
            string cookieLanguage = options.CulturePathEnabled ? getCookieLanguage(context) : null;
            string currLanguage = urlLanguage ?? cookieLanguage;
You should have this instead:
public override async Task Invoke(IOwinContext context)
        {
            string urlLanguage = options.CulturePathEnabled ? getPathLanguage(context) : null;
            string cookieLanguage = options.CookieEnabled ? getCookieLanguage(context) : null;
            string currLanguage = urlLanguage ?? cookieLanguage;
Otherwise, if we update the cookie manually in our code (with a dropdownlist for languages for example), the new culture will be ignored by the middleware and we will go back to the previous culture defined.

comments

frankabbruzzese wrote Jul 7 at 9:51 PM

We will fix this, thanks.

frankabbruzzese wrote Jul 7 at 10:57 PM

Please download the new fixed sources, to see if the issue disappears. As soon as you confir your issues has been solved we'll publish binaries, on both Codeplex and Nuget.

Asshiah wrote Jul 8 at 11:06 AM

This is fixed.

Thank you.