Below you will find pages that utilize the taxonomy term “dotnet”
Posts
Sort list of lists in dotnet core
using System; using System.Text.Json; var array = JsonSerializer.Deserialize<List<List<int>>>("[[3, 2], [1, 1], [0,3],[0,2],[0,1], [1,3], [1,2], [2, 3]]"); Console.WriteLine(JsonSerializer.Serialize(array)); // [[3,2],[1,1],[0,3],[0,2],[0,1],[1,3],[1,2],[2,3]] var sorted = array.OrderBy(y => y[0]).ThenBy(y => y[1]); Console.WriteLine(JsonSerializer.Serialize(sorted)); // [[0,1],[0,2],[0,3],[1,1],[1,2],[1,3],[2,3],[3,2]] Source image/svg+xml
Posts
Test multiple SQL Server connection strings in a dotnet console app
As I have explained how to create some new logins and users in my previous post image/svg+xml , I now had to create some connection strings for those logins. To check if all logins were created successfully, I have created a small dotnet console application to test out the connection strings associated with these logins:
using System.Data.SqlClient; class Credentials { public string Username { get; set; } public string Password { get; set; } public string Server { get; set; } public Credentials(string username, string password, string server = "sql-server.
Posts
IOException: Permission denied for .NET application running as a linux service
For an upload feature, my .NET application needs to upload a file to a newly created directory. My application is running as a linux service. Whenever the application tries to create a folder and add the file, I get an IOException:
An unhandled exception occurred while processing the request. IOException: Permission denied.
At first, I though I’d just chmod 777 the /var/bots folder and give full write permissions. It worked, but it would probably not be a viable and secure solution for the long term.
Posts
Github OAuth redirect_uri_mismatch for .NET App behind a Nginx Reverse Proxy
Let’s say we have a .NET app running on an virtual machine. The app uses Github OAuth for authentication. Inside the virtual machine, the app runs on http://127.0.0.1:5000. The app should be available on https://example.com, so I have created an entry in nginx to send all requests towards https://example.com to http://127.0.0.1:5000:
server { server\_name example.org www.example.org; listen 80; listen 443; location / { proxy\_pass https://127.0.0.1:5001/; } } So this works. My website can be reached from https://example.