Other

This tag is for questions on multiple areas that are not listed. Questions asking us to recommend or find an editor are completely off topic.

49 votes
7 answers
1.6K views
Access the current HttpContext in ASP.NET Core

I need to access current HttpContext in a static method or a utility service. With classic ASP.NET MVC and Sy

avatar
Nidia
0 1 0 9
asked 07 September, 2021
64 votes
5 answers
1.8K views
How to return a specific status code and no contents from Controller?

I want the example controller below to return a status code 418 with no contents. Setting the status code is e

avatar
Wei
0 1 0 9
asked 07 September, 2021
57 votes
12 answers
811 views
How do I write logs from within Startup.cs?

In order to debug a .NET Core app which is failing on startup, I would like to write logs from within the star

avatar
Lynette
0 1 0 9
asked 07 September, 2021
59 votes
5 answers
932 views
Send HTTP POST message in ASP.NET Core using HttpClient PostAsJsonAsync

I want to send dynamic object like new { x = 1, y = 2 }; as body of HTTP POST message. So I try to write v

avatar
Patsy
0 1 0 9
asked 07 September, 2021
62 votes
10 answers
1.9K views
How do I access Configuration in any class in ASP.NET Core?

I have gone through configuration documentation on ASP.NET core. Documentation says you can access configurati

avatar
Eddie
0 1 0 9
asked 07 September, 2021
60 votes
3 answers
1.7K views
Return file in ASP.Net Core Web API

Problem I want to return a file in my ASP.Net Web API Controller, but all my approaches return the HttpRespon

avatar
Corrin
0 1 0 9
asked 07 September, 2021
56 votes
13 answers
2.7K views
.NET Core MVC Page Not Refreshing After Changes

I'm building a .NET Core MVC on the latest version 2.2. I have a problem when I make changes to the CSHTM

avatar
Virgil
0 1 0 9
asked 07 September, 2021
50 votes
4 answers
807 views
Token Based Authentication in ASP.NET Core

I'm working with ASP.NET Core application. I'm trying to implement Token Based Authentication but ca

avatar
Dorian
0 1 0 9
asked 07 September, 2021
53 votes
6 answers
2.1K views
Where did IMvcBuilder AddJsonOptions go in .Net Core 3.0?

I've just upgraded my ASP web API project from .Net core 2.0 to 3.0. I was using services.AddMvc(

avatar
Kurtis
0 1 0 9
asked 07 September, 2021
61 votes
15 answers
2.2K views
How to get current user in asp.net core

I want to get the current user, so I can access fields like their email address. But I can't do that in a

avatar
Percy
0 1 0 9
asked 07 September, 2021
57 votes
6 answers
2.2K views
The default XML namespace of the project must be the MSBuild XML namespace

I cloned the ASP.NET Core SignalR Repo locally, and try opening the solution from within the following environ

avatar
Dwain
0 1 0 9
asked 07 September, 2021
65 votes
15 answers
2.3K views
How to unit test with ILogger in ASP.NET Core

This is my controller: public class BlogController : Controller { private IDAO<Blog> _blogDAO;

avatar
Shantay
0 1 0 9
asked 07 September, 2021
67 votes
17 answers
2.9K views
Publish to IIS, setting Environment Variable

Reading these two questions/answers I was able to run an Asp.net 5 app on IIS 8.5 server. Asp.net vNext early

avatar
Tana
0 1 0 9
asked 07 September, 2021
65 votes
21 answers
1.8K views
The term "Add-Migration" is not recognized

I'm using this MSDN Tutorial to run in VS2015 the command PM> Add-Migration MyFirstMigration -context

avatar
Hallie
0 1 0 9
asked 07 September, 2021
54 votes
3 answers
2.5K views
How to SetBasePath in ConfigurationBuilder in Core 2.0

How can I set the base path in ConfigurationBuilder in Core 2.0. I have googled and found this question, thi

avatar
Charis
0 1 0 9
asked 07 September, 2021
62 votes
2 answers
1.4K views
InvalidOperationException: Unable to resolve service for type &apos;Microsoft.AspNetCore.Http.IHttpContextAccessor&apos;

I started to convert my asp.net core RC1 project to RC2 and faced with problem that now IHttpContextAccessordo

avatar
Kisha
0 1 0 9
asked 07 September, 2021
58 votes
12 answers
918 views
ASP.NET Core return JSON with status code

I'm looking for the correct way to return JSON with a HTTP status code in my .NET Core Web API controller

avatar
Robyn
0 1 0 9
asked 07 September, 2021
60 votes
9 answers
1.5K views
.NET Core Unit Testing - Mock IOptions<T>

I feel like I'm missing something really obvious here. I have classes that require injecting of options u

avatar
Boyd
0 1 0 9
asked 07 September, 2021
61 votes
10 answers
2.4K views
Using &apos;UseMvc&apos; to configure MVC is not supported while using Endpoint Routing

I had an Asp.Net core 2.2 project. Recently, I changed the version from .net core 2.2 to .net core 3.0 Previ

avatar
Don
0 1 0 9
asked 07 September, 2021
66 votes
4 answers
2.7K views
What is Kestrel (vs IIS / Express)

What is the kestrel web server and how does it relate to IIS / IIS Express? I come from developing apps on II

avatar
Alba
0 1 0 9
asked 07 September, 2021