Questions tagged [asp.net-core]

ASP.NET Core is a lean, composable and cross-platform framework for building web and cloud applications. It is fully open source on GitHub. ASP.NET Core apps can be run on Windows with the full .NET Framework or smaller .NET Core, or on Linux and MacOS with .NET Core and Mono.

0
votes
0answers
14 views

Issue when checking if file exists in shared drive

I am trying to find out if a file exists in a shared drive from a Windows machine in the local network. The drive can be easily mounted and accessed with my machine and it does not require credentials....
0
votes
0answers
12 views

ASP.NET Core 2.1 Referring to ApplicationDbContext from Class Library

I have these 2 projects App.ClassLibrary and App.Data I followed this tutorial https://garywoodfine.com/using-ef-core-in-a-separate-class-library-project/ to move my migrations and models to App....
0
votes
0answers
5 views

DataTables.net Width not working with Sort

I am using DataTables.net to populate a table, however, I cannot get the Width option to work. I have tried several of DataTables options to do so all without any luck, so I created a CSS function to ...
0
votes
1answer
15 views

ASP.NET Core using UserManager or Entity Framework to validate extended form field

I've followed the procedure to scaffold the Razor Class Library as per: Scaffold Identity in ASP.NET Core projects I've also extended my model to include a property called Office365DomainName: [...
1
vote
0answers
13 views

Combining metrics of multiple docker containers of same service

Was wondering if this is possible. I have an Asp net core 2.1 app that is hosted in AWS as ec2 instance. There is an autoscale policy to bring it up to three instances if needed. In this service ...
0
votes
1answer
34 views

ASP.NET Core 2.1 Where to find database after performing migration

I have just started a new .net core project and created my first migration and updated the database locally. How can I view the table? In my previous ASP.NET MVC project, I could connect to .\...
0
votes
0answers
16 views

Can't migrate Angular 4 project with ASP.NET Core backend to latest angular version in VS2017

I have only started working with Angular this year, and being experienced in .NET development, my backend is in ASP.NET Core. The Visual Studio 2017 template (not VS Code) worked fine for Angular 4, ...
0
votes
0answers
16 views

Seed in Entity Framework Core Many-to-Many

how can one seed a many-to-many relation in EF Core, couldn't find anything in this area? So this is the entities public class Student { public int Id { get; set; } public string Name { ...
0
votes
0answers
9 views

.net core RouteData pattern matching

I'm trying to match a route using the routedata object that's returned from the HttpContext.GetRouteData() method in asp.net core. Assuming an endpoint of 'http://localhost/dogs/breed' exists, what ...
0
votes
0answers
16 views

Offset to Central Directory cannot be held in an Int64 .net core

I am getting "Offset to Central Directory cannot be held in an Int64" exception while using ZipArchive in .NET CORE.  NOTE: I am not getting it in my developement machine (Windows 7), but getting it ...
0
votes
0answers
29 views

.Net Core server controlled media streaming

I have to write a web application that can stream audio media to the clients. The hard part is that the server needs to control the streaming, so I can not give a simple mp3 (or something like that) ...
1
vote
1answer
18 views

How to deal with concurrency failure on IdentityUser update?

I have a method to update user claims within our app. I am logged as an admin user who can edit other users. I am trying to remove existing claims of one user and assign new ones. When removing ...
0
votes
0answers
16 views

Manually utilizing model binders from RazorPages in ASP.Net Core 2.x

Asp.Net Core RazorPages has this feature where it'll automatically map URL queries and form data to a PageModel object using the BindProperty attribute. public class MyModel : PageModel { [...
0
votes
1answer
19 views

How to read X509 Signing Certificate content from string in .net?

I have X509 Signing Certificate inside of a string like: var signingCertificate = -----BEGIN CERTIFICATE-----\r\nMIICTjCCAbegAw.........-----END CERTIFICATE----- Now I want to read the content of ...
0
votes
0answers
9 views

How to create dynamic side bar on Razor Page C#

Any solution of creating dynamic side bar on Razor Page? Please help, i'm stuck on this 2 days. Can't find any solution of Razor Page, all i found is only the ASP.NET MVC Core
1
vote
0answers
25 views

Rotativa.AspNetCore not working after deployment in smarterasp

In my latest NetCore(2.0) project I am using Rotativa.AspNetCore, everything worked fine(locally) since I published it to SmarterAsp. The main problem is that when I'm trying to generate PDF file ...
0
votes
0answers
10 views

Xamarin forms: AspNetCore.SignalR.Client v1.0.3, websocket transport not working

Background: I would like to connect to my SignalR hub using Xamarin forms SignalR websocket transport. My setup: -> SignalR hub is sitting on a Windows VM. I am connecting to the VM using the ...
2
votes
1answer
47 views

'Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection

I'm using ThreadPool with generic repository and I'm getting this error; 'Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency ...
1
vote
2answers
20 views

Keep documentation xml file while running publish with -c Release

I'm trying to build a project that includes swashbuckle and for troubleshooting I want to include swagger into a release build. I've narrowed it down to this now: When I run dotnet publish -o ./...
0
votes
2answers
39 views

asp.net core 2.1 target .Net Framework and run on IIS without hosting bundle

I have a .NET Core 2.1 application with target framework .Net Framework 4.6.1. I would like to host it on IIS but I don't want to install .net core hosting bundle. Is it possible to run this app on ...
0
votes
0answers
27 views

Store Json string as MongoDB array in C#

I want to store a JSON string in an array format in MongoDB.This is my C# code for storing notification into MongoDB, here the field "Event_meta" field sending as a JSON string format to MongoDB. ...
0
votes
1answer
44 views

Access automapper from other class library in .net core

I am using asp.net core 2.0. I have DataAccess project and 20 API service project in my solution. And this number increasing every day. I will use AutoMapper. But I don't want to add automapper from ...
0
votes
0answers
20 views

How does Stripe ensures that Card number is not stored by website? [on hold]

Created stripe custom form. <form action="/payment/post" method="post"> @Html.AntiForgeryToken() <div class="row"> <div class="...
1
vote
1answer
25 views

Call WeatherAPI with HttpClient

I created Web API to receive daily temperature from OpenWeatherAPI. I put the API call in the MVC project; (plan to create new project later for better microservice architecture.) Someone had ...
0
votes
0answers
19 views

How to Add Related Entities to EF Core Razor Page Create Entity Form

I have the following entities: public class Item { public int ItemId { get; set; } public int ItemTypeId { get; set; } public ICollection<ItemVersion> ItemVersion {...
1
vote
1answer
41 views

Enabling CORS with .NET Core and Angular 6

I am trying to enable CORS within my ASP.NET Core API and allow passing cookies from my client application (Angular 6). However, whenever I attempt to hit an endpoint through my Angular application, I ...
1
vote
1answer
23 views

How to issue and validate jwt from single service endpoint?

I have successfully wired up a token-based authorization system between an Angular front end Web Application and a .Net Core Web API back end (for getting data). Now, I want to consolidate the JWT ...
1
vote
1answer
30 views

asp.net api return json from MongoDB

I'm trying to return a document from MongoDB. I would prefer not to create a model due to the amount of fields in each document. This is what my current output looks like: "[{ \"_id\" : ObjectId(\"...
-1
votes
0answers
16 views

.NETCore connections TIME_WAIT for third-party API user to authenticate

We are using a single-user account to make request to a third-party API. The ThirdPartyApi class is a wrapper for this API and used via our Web API application. Question Any help with a better ...
0
votes
1answer
43 views

Filtering DTO in by role or granular permission

Is there a way to filter a DTO based on permissions? As an example: class User { int id {get; set} string secretInfo {get; set} string publicInfo {get; set} } If a client is requesting ...
0
votes
1answer
14 views

What is the equivalent of the HttpResponseBase.BufferOutput property in ASP.NET Core 2?

I am in the process of converting a large .NET Framework project to a .NET Core project, and I have come across the following code: public class ContentStreamingResult : ActionResult { private ...
0
votes
1answer
23 views

SOLVED: File upload from Angular 6 to Core Web Api hosted on Local IIS not working

I'm currently working on an Angular 6 app with a Asp.Net Core (2.1) Web Api project. My goal is to upload a file from the Angular front-end to the web api. Everything is working locally (testing via ...
0
votes
0answers
22 views

EF Core .FromSql to run stored procedure can't handle aliases when hosted on the server

I have an ASP.Net Core 2.1 website using EF Core that works fine when running on my local PC (Windows 10 Pro) in VS and in IIS and connected to the Live database. However when I deploy this website ...
-2
votes
0answers
22 views

Initialize Json configuration settings in a Controller with IOption Pattern

Reading configuration data from Json into ASP.Net Controller is common enough. I have been stuck with trying to add Emails settings from a Json file. The pattern already works fine from Services with ...
0
votes
1answer
30 views

Ajax request returning error while .net core controller returning 200 Ok

I am calling .net core action via ajax request. It's not even waiting for the return statement but as soon as I am calling Auth0 management api it's returning error. [HttpPost] public async ...
0
votes
0answers
43 views

Standard practice for .net core services [on hold]

I have a simple question. I am trying to make a REST/Web API service in .NET core and I am new to the technology. Using Java for a long time I have the tendency to make a project like this: Project ...
-5
votes
0answers
30 views

How do I Inject IOptionMonitor when use Autofac in Aps.Net core? [on hold]

How do I Inject IOptionMonitor when use Autofac in Aps.Net core? I know how to inject IOptions, like: var feedRedisOptions = Configuration.GetSection("FeederCache").Get<RedisOptions>(); ...
0
votes
1answer
25 views

Account/Login not found - identity

I am putting identity in my already created project, but it is not locating the Account/Login page. It is not localizing the page, this is the controller: [Route("[controller]/[action]")] public ...
1
vote
1answer
22 views

ASP.NET Core UrlHelper and how it works

I'm rather new to ASP.NET Core, and right now I am trying to get a grasp on how UrlHelper works in general. In my controller, I want to create an absolute URL to another action in the same controller,...
0
votes
1answer
22 views

Can I impersonate EF with Azure AD connected user?

I am working on a Core 2 web app and I need to access the internal SQL Server with the user that has been logged in through the Azure AD Connect (SSO). I am trying to impersonate the user using ...
0
votes
2answers
65 views

How to check if the request param of GET request is valid? C#

I want to check if in the GET request (this is GET request) there is only customer id provided and not other parameters. How should I check this in the current context and which is the exception that ...
0
votes
1answer
24 views

Repopulate form data when validation fails in aspnet core Razor Page

Thanks in advance for any help I am working in aspnet core 2.1 razor pages. I need to repopulate form data when validation fails or ModelState is Invalid. In MVC, we can use return View(model) but ...
2
votes
1answer
50 views

AutoMapper - Map Derived Class To Dto

Im trying to map a Class which inherits from a base class to a dto. public class LaunchConfiguration : Document { public string Brand { get; set; } public string SettingName{ get; set; } } ...
0
votes
3answers
53 views

Access database from layout.cshtml in .net core

I have a set of users in a model like this: [Key] [Required] public int ID { get; set; } [ForeignKey("Employee")] public int? EmployeeID { get; set; } ...
1
vote
1answer
31 views

Not entering Controller while validating with Data Annotations

I am using ASP.NET Core restful web API. My problem is that I have a server validation inside my controller to check for view model (Contact.cs) validation. However when I test my POST action ...
0
votes
1answer
49 views

ASP.NET Core Disable CORS for specific controllers

I have different set of controllers in my application (let's say A and B). CORS for A controller needs to be enabled and disabled for B controllers. I have configured CORS via the policies in the ...
0
votes
1answer
18 views

How to insert data to details Table in mvc core using (Jquery) or (Jquery and Ajax)

old school c# developer here.. long story short, the company I'm working for has decided to continue developing using core technology and as a former winforms developer I'm not familiar with the web ...
0
votes
0answers
20 views

Asp.Net core 2 multilanguage

I do site and do localization. But I have a problem. Items not appear in Select How can I fix the error? Please tell me. HomeController [HttpPost] public IActionResult SetLanguage(string ...
0
votes
0answers
19 views

Does Microsoft.AspNetCore.All 2.1.4 support DotNetCore 2.2?

I have recently migrate DotNetCore 1.1 to DotNetCore 2.2. It seems Microsoft.AspNetCore.All 2.1.4 only support DotNetCore 2.1. I am getting the following error: This version of Microsoft....
0
votes
0answers
11 views

Can I connect to an internal SQL Server 2017 instance using Azure AD Connect?

I am developing a Core 2 Website using Azure AD Connect to authenticate. Authentication is working fine but now I need to impersonate the logged used to connect to our internal SQL Server. Is that ...