Set Accept header on ServiceStack JsonServiceClient
I am using the ServiceStack.JsonServiceClient to attempt to make a URL request with a custom value for the Accept header, but am unable to find a way to make the call. The service call is to retrieve...
- Modified
- 11 May at 16:6
Why is a generic type constrained by 'Enum' failing to qualify as a 'struct' in C# 7.3?
If I have a generic interface with a `struct` constraint like this: ``` public interface IStruct<T> where T : struct { } ``` I can supply an enumeration as my type `T` like so, because an `enum` sa...
Dynamic localized WPF application with resource files
Trying to make my wpf appliaction localized, I followed [this CodeProject tutorial](https://www.codeproject.com/Articles/299436/WPF-Localization-for-Dummies). I created my localized resource files (e...
- Modified
- 11 May at 18:38
Disable system font size effect in my app
I don't want the system font size have any effect in my app. If I increase system font size in Android settings, the text in my app will be unreadable (i.e. too big). How can I solve it? I'm writing m...
- Modified
- 6 May at 06:9
DotNet Core console app: An assembly specified in the application dependencies manifest
Im just trying to run a DotNet Core console app on a Windows Server 2012 R2 but I keep getting this error: The dll that is missing is inside the /publish folder... I used Dotnet publish with the co...
.Net Blazor benefits over Angular , React or other javascript framework
What is the main feature of Microsoft's .Net Blazor? Can we use it in place of React or Angular? Will Blazor provide all the tools which are provided in Angular or React?
- Modified
- 6 Sep at 13:2
How get a Span<byte> view of a struct without the unsafe keyword
How can a `Span<byte>` view (reinterpret cast) be created from a single struct value with no copying, no allocations, and keyword. I can currently only accomplish this using the unsafe keyword: `...
- Modified
- 7 Jun at 17:8
How to redirect on ASP.Net Core Razor Pages
I am using the new Razor Pages in ASP.Net core 2 Now I need to redirect I tried this, but the page does not redirect: ``` public class IndexModel : PageModel { public void OnGet() { ...
- Modified
- 10 May at 21:43
VS Code CSC : error CS1617: Invalid option '7.3' for /langversion
I downloaded VS 2017 15.7, .NET Core 2.1.2 and Blazor to try it out. It wasn't working in VS 2017 properly and thought I would try through the dotnet cli and VS Code. Instead I was met with the follo...
- Modified
- 18 Dec at 15:37
Correlation failed in net.core / asp.net identity / openid connect
I getting this error when a Azure AD user login (I able to get the user´s claims after), im using a combination of OpenIdConnect, with asp.net Identity core over net.core 2.0 > The trace: > ![Co...
- Modified
- 10 May at 02:28
Require authentication for (almost) every request using ServiceStack
I am building an ERP using ServiceStack and have authentication wired in and working. However, I'd like to require authentication on basically every single route, DTO, or static page - except the Log...
- Modified
- 9 May at 17:9
ServiceStack OrmLite - using String type for > and < expressions
I have the following POCO class, where Date is defined as a string and will always conform to the following format 'yyyyMMdd' ``` public class Price { [AutoIncrement] public int Id {get;set;}...
- Modified
- 9 May at 13:41
Visual Studio 2017 Error --Cannot connect to runtime process
I am getting this error whenever I try to debug my project from visual studio. I tried adding these settings to launchSettings.json but still no difference. > "protocol": "legacy", "runtimeA...
- Modified
- 4 Feb at 21:50
c# DateTime.Equals() not working properly
I am trying to compare two DateTime variables which are having the same values in it. But when I use Equals method it returns false which indicates "Not Equal". My code is : ``` DateTime date = Da...
- Modified
- 9 May at 10:27
Export to Excel in ASP.Net Core 2.0
I used to export data to excel in asp.net mvc using below code ``` Response.AppendHeader("content-disposition", "attachment;filename=ExportedHtml.xls"); Response.Charset = ""; Response.Cache...
- Modified
- 9 May at 06:56
How do you update sub-document in cosmos db
I am new to Cosmos Db and want to understand how to delete/upsert sub-documents within a document collection. If i have a document: `{ "Id": "1234", "Name": "foo", "Items": [ { "Id": "abcd", "Age": ...
- Modified
- 9 May at 02:13
DPI Awareness - Unaware in one Release, System Aware in the Other
So we have this really odd issue. Our application is a C#/WinForms app. In our 6.0 release, our application is not DPI aware. In our 6.1 release it has suddenly become DPI aware. In the 6.0 release, i...
User.Identity fluctuates between ClaimsIdentity and WindowsIdentity
I have an MVC site that allows logging in using both Forms login and Windows Authentication. I use a custom MembershipProvider that authenticated the users against Active Directory, the System.Web.Hel...
- Modified
- 14 May at 08:58
How to have different log types using Serilog and ElasticSearch
I am currently trying to change our system configuration to work with **Serilog** (*instead of working with FileBeat as a shipper to LogStash*) We are also working with the log **type** field (which i...
- Modified
- 18 Jul at 07:43
Create X509Certificate2 from PEM file in .NET Core
I want to create a X509Certificate2 object based on a PEM file. The problem is setting the PrivateKey property of X509Certificate2. I read [X509Certificate2.CreateFromCertFile() on .NET Core](https://...
- Modified
- 9 May at 16:48
Securing a SPA by authorization server before first load
I am using the 'new' project templates for angular SPA applications in dotnet core 2.1 as written in the article [Use the Angular project template with ASP.NET Core](https://learn.microsoft.com/en-us/...
- Modified
- 8 May at 04:37
How to set up unit tests in Unity and fix missing assembly reference error?
I created the following structure: ``` ├── Assets ├── Scenes ├── Scripts │ └── MyExample.cs ├── Tests │ ├── MyExampleTest.cs │ └── Tests.asmdef ``` Now, when I click on Run All, in the Test R...
- Modified
- 8 May at 18:6
ASPNetCore - Uploading a file through REST
I am using Insomnia for testing an API, but the same happens with Postman. I want to test a file upload, with the following controller: ``` public async Task<IActionResult> Post([FromForm]IFormFile ...
- Modified
- 27 Nov at 19:1
Asp.net Core 2.0 RequestSizeLimit attribute not working
I'm creating a website in Asp.net core 2.0 which allows files to be uploaded. I quickly came across the problem of the `30MB` upload limit and receive a `404` response from the server. Below this li...
- Modified
- 7 May at 19:36
C# 7.3 Enum constraint: Why can't I use the enum keyword?
To constrain a generic type parameter to be of an enum type, I previously constrained them like this, which was the best I could go for constraining type T for enums in pre-C# 7.3: ``` void DoSomethin...