Category "asp.net-core-mvc"

System.Data.SqlClient.TdsParser' threw an exception: System.BadImageFormatException: An attempt was made to load a program with an incorrect format

I am hosting .net core applicaton on server but when I try to run the application it throws exception in windows logs: Unhandled exception. System.TypeInitializ

ServiceFilter and TypeFilter - what is the difference in injection those filters?

ServiceFilter we must register in Startup.cs. TypeFilter is injected by Microsoft.Extensions.DependencyInjection.ObjectFactory, we don't need to register that f

Fetching data from an API in ASP.NET Core MVC

I'm facing problem while fetching data from an API in ASP.NET Core MVC controller (imdb api). The problem is I cannot deserialize the current JSON object into t

Setting connection string with username and password in ASP.Core MVC

I am working on my first ASP.NET Core MVC application.What is the right way to specify the connection string in a ASP.NET Core MVC application with a sql server

Pass current transaction to DbCommand

I'm working on a project using ASP.NET Core 2.1 and EF Core 2.1. Although most of queries and commands use EF, some units needs to call stored procedures direct

DotNetCore 1.0 MVC how to automatically redirect to a single domain in live

I have multiple domains for a website: http://example.com http://www.example.com http://www.example.co.uk In production, I want the primary domain to be htt

How to get the current domain name in Startup.cs

I have a domain that has multiple sites underneath it. In my Startup.cs I have the following code public void ConfigureServices(IServiceCollection services) {

How to get the current domain name in Startup.cs

I have a domain that has multiple sites underneath it. In my Startup.cs I have the following code public void ConfigureServices(IServiceCollection services) {

Adding AddRazorRuntimeCompilation() to the container in .NET CORE 6 will break the CSS footer

I create a brand new ASP.NET Core MVC project using VS 2022 and .NET Core 6. VS will generate the base template and when I run it without touching any code, eve

Adding AddRazorRuntimeCompilation() to the container in .NET CORE 6 will break the CSS footer

I create a brand new ASP.NET Core MVC project using VS 2022 and .NET Core 6. VS will generate the base template and when I run it without touching any code, eve

options.UseSqlServer returns Error in startup.cs

I'm developing a test Project using asp.net core. For Connecting to database I'm using Entity framework. I add appsetings.json file to the project and change th

Update ContextModelSnapshot EF Core

I'm newer to EF Core, so please forgive me if there is a trivial answer. Take this scenario.... A new web-application is being developed using the latest vers

ASP.NET Core MVC (2.2) Error Middle-ware not triggering error pages

In my ASP.NET Core MVC (2.2) app I have completed the setup for a global error handling class. I inject this class in the Startup.cs of my project by using app.

Why doesn't scaffolding work as expected?

I am trying to scaffold and I get the following error: There was an error running the selected code generator: 'No parameterless constructor defined for typ

ASP.NET 5 Authorize against two or more policies (OR-combined policy)

Is it possible to apply authorization against two or more policies? I am using ASP.NET 5, rc1. [Authorize(Policy = "Limited,Full")] public class FooBarControll

ASP.NET Core Razor pages vs Full MVC Core [closed]

There has been a question at SO Why is Razor Pages the recommended approach to create a Web UI in Asp.net Core 2.0? where Steve Smith has kind

.Net Core Dependency Injection inject out of constructor

I need to inject out of constructor, everything I declared in Setup. Ho can I do it ? How can I inject services out of constructor ? Something like Injector s

Change the headers of static files in Asp.net Core

I am using package Microsoft.AspNet.StaticFiles and configuring it in Startup.cs as app.UseStaticFiles(). How can I change the headers of the delivered files ?

Razor engine cant find view

I'm trying to render a HTML from a view without using a web request. I need the HTML as a string, internally, I do not wish to serve it. The viewEngine.FindView

Is it possible to pass a parameter/single form element to a controller via unobtrusive AJAX in ASP.Net Core?

I've got a ASP.Net Core MVC app and I have the need to have certain elements update on a click. For example, a create a person form that searches for an existin