Category: .NET Core
-
Country Tag Helper–part 5
Now the Country Tag Helper supports .NET Standard 2.0 . This means that support .NET Core 2.0 . Also,I have made a NuGET package in order to install on every .NET Core 2.0 application with explanations: https://www.nuget.org/packages/CountryTagHelper The only trouble here was to add references and make documentation in VS2017 about package ( see https://docs.microsoft.com/en-us/nuget/guides/create-net-standard-packages-vs2017…
-
Country Tag Helper–part 4
Now I want to see somewhere in order to prove it Ii s right. I choose https://appharbor.com/ because it is free – and can not beat free for free source. I made github integration and modify the .csproj file accordingly to https://support.appharbor.com/discussions/problems/90387-is-net-core-supported-yet The result is at http://countrytaghelper.apphb.com/ Also,I have to modify the code source…
-
Country Tag Helper – part 3
Adding empty item – easy peasy. Just append "<option selected style=’display: none’ value=”></option>"; For getting the IP,I was trying to balance the 2 variants: downloading GeoIP database (https://dev.maxmind.com/geoip/geoip2/geolite2/) or calling http://freegeoip.net/ . I do call http://freegeoip.net/ – and the next point is to use Dependency Injection … or a provider to do that. For…
-
CountryTagHelper–part 2
Finally,I have arrived at functionality. I said that I want something like <select asp-country="true" asp-country-selected="US" > </select> The functionality is very easy to be added: The entire class is : The important thing is that it works with other html attributes,like <select asp-country="true" asp-country-selected="US" disabled=”disabled”> </select> What it remains to…
-
Country tag helper–part 1
What I want to do is to create a Country Tag Helper for asp.net core. Something like <select asp-country=”true” and then list all countries in this select. More,it should be localized ( Germany vs Allemagne). That means 1 or more resource files First I need initial data: The WorldBank API gives us the…
-
Making any call to a function of an object thread safe
I was wondering how to modify old code to support threads /task . So I was making a small project about making any function of an object thread safe. NuGet Package at : https://www.nuget.org/packages/ThreadSafeObject/ The solution contain tests and 2 console project for .NET Core and .NET Framework 4.5.1 The usage is pretty…
-
InternalsVisibleTo usage
I do not know if you know InternalsVisibleToAttribute https://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396 . I have used on a project https://github.com/ignatandrei/WorldBankAPi,that deals with World Bank API to get information Let’s take an example: Countries: http://api.worldbank.org/countries?format=json I have had a class CountriesRepository,that deals with transforming countries Json from WorldBank to Country classes. How can I test it WITHOUT relying on…
-
ImageTagHelper in .NET Core–add data URI scheme
The ImageTagHelper in ASP.NET Core MVC (https://github.com/aspnet/Mvc) is lacking one attribute that I find somehow useful: a data uri to embed the image as base64 (https://en.wikipedia.org/wiki/Data_URI_scheme ) I was curious about how fast it will be to make such a modification on my PC. So the process was: Downloading branch rel/1.1.1 from https://github.com/aspnet/Mvc as a…
-
ASP.NET Core and Windows Authentication
Just a reminder of how to configure ASP.NET Core and Windows Authentication 1. Configure IIS 2. Go to properties folder,file launchSettings.json and modify "iisSettings": { "windowsAuthentication": true, "anonymousAuthentication": false, //other data 3. When you compile and run,the Web.Config will be modified for forwardWindowsAuthToken : <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" forwardWindowsAuthToken="true" stdoutLogEnabled="false" />