Where do I find Web.Config in ASP.NET CORE MVC 3.1?

Asked

Viewed 253 times

0

I’m having problems with accentuation in a View, already opened in the notebook my view’s in . cshtml and save all with UTF-8 but it is still having accentuation problem in the application still, I checked in all folders and did not find the Web.Config only appsettings.json :(

1 answer

1

The real mistake has become a little vague, but perhaps the answer below will solve your case.

I believe you have to create the web.config at hand, the aspnet does not have it as standard. On the question itself, if there is a defined globalized culture, it will take from the machine and if it is with foreign standard, will have problems, perhaps.

In your view must have the following code: @System.Globalization.CultureInfo.CurrentUICulture

remove it.

This can be solved by globalizing the configuration of the App in the class Startup in configure:

    var defaultCulture = new CultureInfo("pt-BR");
    var localizationOptions = new RequestLocalizationOptions
    {
        DefaultRequestCulture = new RequestCulture(defaultCulture),
        SupportedCultures = new List<CultureInfo> { defaultCulture },
        SupportedUICultures = new List<CultureInfo> { defaultCulture }
    };
    app.UseRequestLocalization(localizationOptions);

The App will instantiate with pt-BR as a standard

And in the partial _ValidationScriptPartial you can add a javascript to validate according to how we use for example, thousand separation and decimal, here in Brazil.

about webconfig, see this question: https://stackoverflow.com/questions/40186445/access-web-config-settings-in-asp-net-core-app

Browser other questions tagged

You are not signed in. Login or sign up in order to post.