In apps with different Roles and permissions you may need to get information about AD Groups. Here are some snippets which can help you with this part of the task.
(read more...)In apps with different Roles and permissions you may need to get information about AD Groups. Here are some snippets which can help you with this part of the task.
(read more...)If you work with Net Core WebApi project, it already contains the packages for DI, Environment variables. But if you make a console application from the template, it doesn’t contain the packages for environment variables. And if you want to use different configs for Debug and Release, there are 2 ways:
(read more...)I will write down the useful method. I used it several times and it works good. It's C# method to create a UNC directory recursively and return the path.
(read more...)If you want to write an application which uses RabbitMQ, I advise you to use docker image of Rabbit. It's lightweight and can be easily executed.
(read more...)Create a console app with .Net Framework 4.7.2 with Dapper and datasource in MSSQL Server or PostgreSQL.
If you create this ancient app, you should only add Dapper and NPGSQL packages from Nuget. The support of MS SQL Server is already built in. The scenario for .Net Framework is from real life, several applications still require this framework.
(read more...)Once again I decided to make a new task from LeetCode and finally my process had been stopped. I could not convert Char to Int. I even spent some time for research, but I could not find any solution. Then I open the documentation and started to read.
(read more...)It's not for production, but for developer environments
Add the block below to Program.cs. I talk about Net Core 5 or Net Core 6 application.
// global cors policy
app.UseCors(x => x
.AllowAnyMethod()
.AllowAnyHeader()
.SetIsOriginAllowed(origin => true) // allow any origin
.AllowCredentials()); // allow credentials
I created an application which rendered a report in HTML. To improve it, I wanted it to open the rendered file in browser to simplify the viewing one. In the beginning I thought about using the CMD file, but I found a better solution.
(read more...)In my application I had rendered JSON data with AngularJS and I had to send it to a controller in my MVC application to render PDF file and to allow a user to save it. So, the task was dynamically to submit the request, render a file and allow user to save it.
(read more...)StreamWriter has some options of usage. You can as add new text to an existing text in file, so and to clean existing text and add a new one.