You can exclude files or folders from your published .Net Core project by editing your project file. In Visual Studio, click on the project to open the projectName.csproj file. To exclude the file wwwroot\json\example.json, add the following. <ItemGroup> <Content Update="wwwroot\json\example.json" CopyToPublishDirectory="Never" /> </ItemGroup> To exclude all json files in that folder, add: <ItemGroup> […]
Making a Google map fit in a container
As a developer, adding a Google Map to a responsive page can be difficult because both the minimum width and minimum height have to be specified to make the map display. The best solution is to use “vw” units. 10vw will resolve to 10% of the current viewport width. For example : .themap {min-height: 120vw;min-width: […]
React example of forcing text to wrap under a photo
It can be difficult to get text to wrap under a photo, especially if the photo and text are in a flex box that just gets wider for longer text and you don’t know in advance how wide the photo will be. You want the flex box to stay the width of the photo. However, […]
Using the UserManager service in .net core
If you have used a template to set up razor pages with authentication, you may need to address the UserManager service directly. Injecting the service in the model. In this first example, we inject the UserManager service using the constructor of the Razor Page Model. We assign it to a private field _userManager. Then we […]
A simple example of returning a partial ActionResult in a Razor Page
Returning a partial ActionResult allows us to update content on a page without reloading the page. This simple example lists some students and allows us to display detail about a student with a click. We use entity framework and .net core. In this example, the students are listed with a button next to each student. […]