Skip to main content

Questions tagged [asp.net-core-mvc]

ASP.NET Core MVC is a lightweight presentation framework for creating dynamic websites with ASP.NET Core. It allows for creating controller based MVC sites, or view model based Razor pages. MVC includes features like routing, model binding and validation, filters, web APIs and the Razor view engine.

asp.net-core-mvc
4,882 questions with no upvoted or accepted answers
27 votes
3 answers
9k views

Is there UI to manage ASP.NET Identity users/roles compatible with ASP.NET 5?

I'm using: VS2015u2 ASP.NET 5 MVC 6 I'm looking for some UI to manage users/roles. Some things I've tried: Identity Manager - https://github.com/IdentityManager/IdentityManager I guess it's still ...
f0rt's user avatar
  • 1,901
16 votes
1 answer
4k views

What is the appsetting.json version of <defaultProxy>?

What is the .Net Core appsettings.json version of <defaultProxy useDefaultCredentials="true"> <proxy autoDetect="True" proxyaddress="http://localhost:8888/" ...
CheeZe5's user avatar
  • 985
14 votes
1 answer
3k views

How to use RouteDataRequestCultureProvider with ASP.NET Core 2.2 EndpointRouting enabled?

I am trying to use the RouteDataRequestCultureProvider in a new ASP.NET Core 2.2 MVC project. I've read the Microsoft documentation on Routing in ASP.NET Core to understand the changes introduced in ...
David Schwab's user avatar
12 votes
0 answers
5k views

ASP.NET Core MVC Slow response generation

I have an ASP.NET Core MVC web application that has an endpoint which returns some data as a json. The onlly issue is that my data is around 5 MBs of raw (non-idented) JSON, and the response takes a ...
Hentov's user avatar
  • 483
11 votes
1 answer
14k views

All nuget packages requiring net6.0 are "not compatible with net6.0" even after complete Windows reset

After booting up my PC I tried to continue using a previous project I had been working on: ASP.NET MVC Core 6.0. All of a sudden Microsoft.EntityFrameworkCore was not installed in the solution. After ...
pintoramos28's user avatar
11 votes
0 answers
352 views

What is relation between AuthenticationScheme and IIdentity.AuthenticationType

How are they connected? I can use HttpContext.SignInAsync, and then HttpContext.User is set to provided identity, however I have one identity and multiple authentication ways - what if user login as ...
Shadow's user avatar
  • 2,338
11 votes
1 answer
2k views

ASP.NET Core targeting full framework with EF6 and Identity

I currently have a .NET Core Web App targeting the full .NET Framework and a .NET 4.6.1 class library project that contains my EF6 implementation. I have these two currently working together. Now I ...
Brandon's user avatar
  • 69.6k
11 votes
2 answers
252 views

Date in model binding is being set as American format even though culture is set as British in .net core 2.1

Model binding for date in .net core 2.1 is setting date value in American format even though culture info is set as British format. Any idea ? Here is my startup file code snippet var ...
Anwar Ul-haq's user avatar
  • 1,871
10 votes
3 answers
4k views

Can I use IdentityServer4 spa JS UI instead of asp .net core mvc?

I looked example of IdentityServer4 UI (IdentityServer4.Quickstart.UI) UI in it on the basis of asp .net core mvc. Examples for spa JS UI I have not found. Is is safe to use spa js UI, and how to do ...
Евгений's user avatar
9 votes
3 answers
4k views

Unable to generate deps.json to enable migrations

I use Asp.net core mvc for web developing. I want to enable entityframework migrations via Entity Framework Core .NET Command Line Tools: dotnet ef migrations add InitialDatabase but an error occurs:...
arsmn's user avatar
  • 451
9 votes
2 answers
1k views

First call to ASP.NET Core 2.0 Web API with Windows authentication on HTTPS always fails in Chrome

I am developing an application with ASP.NET Core 2.0 Web Api backend with Windows authentication and React frontend where I am experiencing that the first call to the API made from the frontend fails ...
Avilan's user avatar
  • 608
9 votes
0 answers
1k views

How to correctly localize validation in IValidatableObject.Validate method for ASP.Net Core MVC

I have a model implementing IValidatableObject and I need to localize ValidationResults, how can I correctly achieve that ? Currently I came up with an IValidatableObject.Validate method that looks ...
Gwinn's user avatar
  • 1,338
8 votes
0 answers
420 views

Unit Testing a custom TagHelper where HTML conditionally rendered based on the presence of a ValidationAttribute on the model Property

I have a custom TagHelper which extends the OOTB InputTagHelper. I am conditionally adding attributes to it based on the presence of a custom ValidationAttribute on the model property associated with ...
Ciaran's user avatar
  • 573
8 votes
1 answer
4k views

How to send push notification to Flutter app from Asp.net core

We have a requirement where we need to send push notification to a flutter application ( android,iOS ) from .net core application. I spent sometimes searching on google but didn't find any suitable ...
Mansoor's user avatar
  • 93
8 votes
1 answer
2k views

Is it possible to integrate Microsoft.Extensions.Configuration library with ASP.NET 5?

I decided to migrate one of my ASP.NET MVC 5 applications to ASP.NET Core 2, but I would like to keep both versions working. I've already migrated all class libraries to .NET Standard (so that I can ...
PJDev's user avatar
  • 983
8 votes
0 answers
2k views

Error -4077 ECONNRESET connection reset by peer kestrel

I am having the below error in my .net core application Error -4077 ECONNRESET connection reset by peer What does this exactly means ? I have noticed if kept my application in idle state for long ...
XamDev's user avatar
  • 3,607
8 votes
0 answers
2k views

ASP.net 5 Web API Post CreatedAtRoute always returns 500 Internal Server Error

The database works. It does actually insert the new record, but when I use CreatedAtRoute(), I always get a 500 back from the client. Why? My controller's Get: [Route("api/[controller]")] public ...
Mickael Caruso's user avatar
8 votes
0 answers
406 views

MVC 6 vNext ViewComponent Scripts?

I am building an MVC 6 vNext web application. I am considering using the new ViewComponents to encapsulate "widgets" for my site. Widgets should be able to render and function independently of the ...
user1142433's user avatar
  • 1,541
8 votes
0 answers
2k views

ASP.NET 5 Beta 8 Hosting error: HTTP Error 502.3 - Bad Gateway

I created a new ASP.NET 5 Beta 8 project using simply the default template. When I publish the project and host it on a server using IIS 8.5 I get the error: HTTP Error 502.3 - Bad Gateway There was ...
Miguel Moura's user avatar
  • 38.6k
8 votes
1 answer
6k views

How to use EF6 (DB-first) with ASP.NET core web application(.NET framework 4.6.1)?

I am building asp.net core web application using full .NET framework 4.6.1 template like this- My project.json shows- "frameworks": { "net461": { } }, I wanted to use EF6 (not EF core), ...
Gretel Hendricks's user avatar
7 votes
0 answers
2k views

Visual Studio 2022 is not finding codegenerators for scaffolding

Rel: aspnet-codegenerator: No code generators available, Even after adding Microsoft.VisualStudio.Web.CodeGeneration.Design I have the same issue as presented in the linked question but with Visual ...
ZorgoZ's user avatar
  • 3,238
7 votes
0 answers
514 views

Tag helpers not working with DynamicRouteValueTransformer

ASP.NET Core's tag helpers appear not to be working in combination with DynamicRouteValueTransformer. Here's an MCVE: let's say we have a simple controller with two actions... public class ...
Max's user avatar
  • 9,679
7 votes
0 answers
2k views

How to use DisplayTemplates in MVC core 2.0

I used to use DisplayTemplates in MVC5 to get rid off foreach loops from views If I have a ProductDto and ProductController I would place a ProductDto.cshtml under Views/Product/DisplayTemplates/...
akd's user avatar
  • 6,728
7 votes
0 answers
1k views

No bower/npm config files are part of the latest .NET Core 2.0 Web App templates, but client-side libraries are installed

The latest ASP.NET Core 2.0 template doesn't have a bower config or a packages.json, but comes with client side packages such as bootstrap and jquery. How do we takeover from here and manage these ...
Blake Rivell's user avatar
  • 13.6k
7 votes
1 answer
956 views

Is it possible/sensible to split ASP.Net Core 2 (.NET Framework) Web Api into Class Library and Hosting projects?

I'm trying to port an existing WCF Web API (targeting .NET Framework 4.6.1) to ASP.Net Core 2 using Visual Studio 2017 (v15.4.5) and am having trouble figuring out good/common/supported ways to ...
Norbini's user avatar
  • 81
7 votes
0 answers
1k views

How to ignore key unprotect errors

My application often fails with failed to unprotect session cookie (I am using two applications with different assembly versions). Error unprotecting the session cookie. The key {hex_key} was not ...
Shadow's user avatar
  • 2,338
7 votes
0 answers
2k views

How use IChangeToken to expire a token?

I wont to change a Token when DbContext.SaveChange() method called and ChangeTracker has change: public override int SaveChanges(bool acceptAllChangesOnSuccess) { if (SettingChanged() == true) ...
alireza.salemian's user avatar
7 votes
1 answer
164 views

UrlRewrite Middleware and Client Applications

I am not even sure if url rewriting will fit my use case but I have a feeling it might (using Microsoft.AspNetCore.Rewrite). I have a client served by my ASP.NET Core project with UseStaticFiles(). ...
Lutando's user avatar
  • 5,000
7 votes
0 answers
443 views

How to compile views as a syntax checking in ASP.NET Core MVC 1?

I would like to have a compile-time validation of the views. In my old web application, written for MVC 5, I have these entries located in the csproj file: <PropertyGroup> <MvcBuildViews&...
romanoza's user avatar
  • 4,823
7 votes
1 answer
3k views

Asp.Net Core MVC on Azure Cloud Services?

There are a lot of articles on Asp.Net Core 1.0 and its cross-platform features. I know that it's possible to deploy it to Linux, OSX, Windows. I've read a lot fo step-by-step articles how to do that. ...
Adalyat Nazirov's user avatar
7 votes
0 answers
1k views

There are no runtimes matching the name dnx-clr-win-x86 on feed https://www.nug et.org/api/v2

When I create the default demo web project with ASP.NET Core 1.0, it uses the dnx-clr-win-x86.1.0.0-preview2-003121 runtime in the global.json. Visual Studio 2015 will ask me to download this runtime ...
user2713516's user avatar
  • 3,015
7 votes
1 answer
2k views

MVC 6: System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource

I got this error in my staging environment but don't get it in my local environment. The staging server is Windows Server 2008 R2. System.IO.FileNotFoundException: Could not load file or assembly '...
diverge's user avatar
  • 101
7 votes
0 answers
239 views

Modifying the solution level files in an MVC 6 Project to install a new layout

I have an MVC 6 (ASP.NET 5) solution and I would like to have a way to easily "install" a new layout in Visual Studio 2015. I have the following files ~/Views/Shared/_Layout.cshtml ~/Views/Shared/{...
Paul Totzke's user avatar
  • 1,430
7 votes
0 answers
970 views

How to use Facebook Authentication in ASP.NET Web Api MVC 6?

I found these: First Web API Facebook on a WebApp I'm trying to apply the knowledge from the above samples into a Web API of my own. My clients will be Android and IOS native apps. The clients ...
Tanielian V. Barreira's user avatar
7 votes
2 answers
2k views

MVC6 routing to single-page application without losing 404

I'm writing a single-page application with angular2 and MVC5. I'm new to both, though, and I'm having trouble with the routing. I'd like to match URLs as: / -> go to my index page, which ...
Matt Tsōnto's user avatar
  • 1,672
7 votes
1 answer
793 views

Publishing ASP.NET vNext / DNX combined with CLR class library

I've added my 'traditional' DAL project to an ASP.NET vNext and worked/debugged with it locally without any problems. But when I tried to publish it to Azure it would not. It states '3>Publish failed ...
Gabriël's user avatar
  • 1,315
7 votes
3 answers
6k views

.NET Core MVC Bundling - Is there an equivalent to System.Web.Optimization.BundleTable.EnableOptimizations = false in ASP.NET MVC Core?

I want to run my application in debug mode without any bundling or minification. In ASP.NET MVC (Framework), I could use System.Web.Optimization.BundleTable.EnableOptimizations = false and the paths ...
gbro3n's user avatar
  • 6,897
7 votes
1 answer
2k views

Dynamically Loading an ASP.NET Core Assembly

I am trying to dynamically load a .NET Core DLL containing an ASP.NET Core's Startup class. I then want to instantiate the Startup class and hand it over to the TestHost API, so I can start the site ...
Muhammad Rehan Saeed's user avatar
7 votes
2 answers
8k views

Best way to inject Serilog into repository for logging

I can inject the ILogger into a controller but I'm having an issue trying to inject it into a repository class. Here is my Startup method: public Startup(IHostingEnvironment env) { // ...
forwheeler's user avatar
6 votes
0 answers
1k views

How to lint .cshtml files?

Using ESLint, it's easy to lint *.js files. Using a plugin like html or script-tag, it's also simple to lint JavaScript code inside tags in *.html files. However, when it comes to script tags inside ...
Dely's user avatar
  • 93
6 votes
0 answers
537 views

Can I use a pure javascript es6 with a ASP,NET CORE MVC Multi-page Application?

I am working in a asp.net core mvc application, and I would like to use a client side framework. Most of the code is made in razor, so I dont want something too complex as React, angular, etc... So, ...
Flezcano's user avatar
  • 1,677
6 votes
0 answers
5k views

Asp.NETCore 3.1 With Swagger launchUrl does not work after Publish

ASP.NET Core Web API project is configured with Swagger. When I run the project on my local machine the launchUrl works correctly and automatically redirects to my Swagger apidocs location (https://...
ameya's user avatar
  • 1,608
6 votes
0 answers
2k views

How to seed data without key in Entity Framework Core 3?

Description I want to seed data into my database. The data hasn´t a key or id value. But for some reason I got the error: System.NullReferenceException: Object reference not set to an instance of an ...
Lukas Gund's user avatar
6 votes
0 answers
2k views

Why am I experiencing poor performance with Task.WhenAll, RestSharp, and Async-Await in API gateway?

I am writing a Search API that aggregates results from a number of microservice APIs using async-await and awaiting Task.WhenAll. At most, I make 11 microservice API calls per request to to the Search ...
Switch386's user avatar
  • 462
6 votes
0 answers
2k views

Entity Framework Core foreign key from separate database

I am new to EF Core and databases in general since I am a student still. I have a requirement in the project I am making to have a separate Identity database from the application database. I have the ...
jleibman's user avatar
  • 157
6 votes
0 answers
3k views

JsonSerializationException due to IFormFile

So long story short I have a view where Im using @using (Html.BeginForm("AddFormToOrder", "Form", FormMethod.Post, new { @id = "OrderForm", enctype = "multipart/form-data" })) which will have a ...
JDawg848's user avatar
  • 121
6 votes
0 answers
8k views

InvalidOperationException:The property has a temporary value while attempting to change the entity's state to 'Modified

i have two classes with one to many relation public class Foo { public int FooId { get; set; } public string Description { get; set; } public ICollection<Bar> Bars { get; set; } }...
rajin's user avatar
  • 107
6 votes
0 answers
815 views

Unit test using HtmlHelper in ASP.NET Core

Although there are tag helpers now, you still need HtmlHelper from time to time, e.g., inside your tag helpers. I'm trying to write tests for one of my tag helpers which calls into HtmlHelper. In ASP....
D.R.'s user avatar
  • 20.9k
6 votes
2 answers
2k views

Rewriting forward slashes in a query parameter

In my asp.net core app (angular 4 front end) I accept a URL like this: example.com/report;url=http%3A%2F%2Fexample2.com I would like to create a rewrite rule that allowed people to enter the ...
Guerrilla's user avatar
  • 14.4k
6 votes
0 answers
216 views

InvalidOperationException when trying to do SignInAsync

I am trying to sign a user in, in a normal controller. I have something along the lines of: var claims = new List<Claim> { new Claim(JwtClaimTypes.Subject, "xxx-xxx-xx-xxx), new Claim(...
Lutando's user avatar
  • 5,000

15 30 50 per page
1
2 3 4 5
98