Questions tagged [asp.net-core-2.0]

1

votes
1

answer
3.1k

Views

Connection ID required

I am trying to build a simple chat application using SignalR with ASP.NET Core 2.0. The problem is that when I want to access one of my hub's url (localhost:5000/chat) I receive as a response: Connection ID required with error code 400. I am using auto generated from template authentication (users...
Georgi Stoimenov
1

votes
1

answer
1.8k

Views

Generate Razor HTML emails in dotnet core 2

How can you generate emails (html) using Razor in dotnetcore - and not from an MVC app (think from a console app)? RazorEngine does a great job in .net 4.x, but is not working in dotnet core. RazorEngineLight works in dotnet core 1.x, but not in 2.x. Some other options are mentioned in this post: Us...
Kjensen
1

votes
2

answer
1.9k

Views

How to read connection string inside .NET Standard Class library project from ASP.NET Core

In my solution, I have a ASP.NET Core web project and a .NET Standard class library project. Class library project is the data access layer and I want to read the connection string from my appsettings.json (ASP.NET Core project) in my data access layer. I have found few answers such as by Andrii Li...
Learning Curve
1

votes
2

answer
188

Views

Is it able to store Firebase user to our own database?

If I use the user registration and login through the firebase authentication, the user information are stored in the firebase database side. How can I get the user information (such as FirstName, LastName, Gender and etc.) and store in my own database? Is it use the access token to call my API to ch...
ZhengJie Tan
-1

votes
1

answer
21

Views

How Can used HttpClient in asp.net core 2.2 to get data from url in share host?

I'm writing asp.net mvc core 2.2 also I need to get data from another web server with Http or Https. How can I do this I wrote code to using HttpClient in my code? my program is a Telegram Bot and I wrote this to get url from telegram and after checking and validating that I call url with HttpClient...
Faraz
1

votes
1

answer
1.8k

Views

Get a service in a IServiceCollection extension

I have this extension public static class ServiceCollectionExtensions { public static IServiceCollection MyExtension(this IServiceCollection serviceCollection) { ... } } and I need to get information from a service like this: services.AddAuthentication(options => { options.DefaultAuthenticateScheme...
andres descalzo
1

votes
2

answer
336

Views

asp-for in checkbox throws and error in asp.net core

Here i have used two checkbox Send Report Send Invoice and data type for both checboc i.e asp-for='SendReport' and asp-for='SendInvoice' is bit. Now the problem is that when ever i try to load the page its throws error as below Unexpected 'asp-for' expression result type 'System.Nullable`1[[System.B...
redcaper71
1

votes
3

answer
610

Views

Create text file and download without saving on server in ASP.net Core MVC 2.1

I've found a way to create a text file then instantly download it in the browser without writing it to the server in regular ASP.net: Create text file and download The accepted answer uses: using (StreamWriter writer = new StreamWriter(Response.OutputStream, Encoding.UTF8)) { writer.Write('This is t...
niico
1

votes
3

answer
89

Views

EF Core ExecuteSqlCommandAsync : Conversion failed when converting the nvarchar value '1,2' to data type int

I am running executing raw sql to delete some records that I added for the test. If I run the same query in management studio it works fine but when I run that query EF Core 2.0 it throws below error System.Data.SqlClient.SqlException: 'Conversion failed when converting the nvarchar value '1,2' to d...
Bhavesh
0

votes
0

answer
11

Views

Property injection

I'm trying make a telegram bot with reminder. I'm using Telegram.Bot 14.10.0, Quartz 3.0.7, .net core 2.0. The first version should : get message 'reminder' from telegram, create job (using Quartz) and send meaasage back in 5 seconds. My console app with DI looks like: Program.cs static IBot _botCli...
Galina
1

votes
0

answer
249

Views

HTTP Error 502.5 - Process Failure in .Net core 1.1

It was not possible to find any compatible framework version The specified framework 'Microsoft.NETCore.App', version '1.1.2' was not found. Check application dependencies and target a framework version installed at: Alternatively, install the framework version '1.1.2'. I installed Windows (Server H...
Shah Niral
1

votes
1

answer
1.4k

Views

.NET Core 2.0 API with EF6 and .edmx file?

I want to build a API using .NET Core 2.0 that targets the full .NET framework so I can work with Entity Framework 6 and an .edmx file. Is this possible? How do I inject the DbContext generated by the .edmx file? I want to do this because my project works with a lot of stored procedures and I don't...
genzop
1

votes
1

answer
99

Views

Why is my post data all null when posting with HttpClient?

I am trying to post an object from a client web app to a CRUD API for said client. I am using the following code to make the post request: var respP = await _client.PostAsync('api/Persons', new StringContent(JsonConvert.SerializeObject(person), Encoding.UTF8, 'application/json')); And the API action...
ProfK
1

votes
1

answer
861

Views

Database connection not created in IdentityDbContext

I'm trying to authentication Asp.Net Core 2 Web API with Asp.Net Identity 2. Here's my code for the AuthController and the databasecontext: public AuthController(UserManager userManager, SignInManager signInManager, RoleManager roleManager , IPasswordHasher passwordHasher, IConfiguration configurati...
devC
1

votes
1

answer
726

Views

Add custom Font to .NET Core 2.0 Angular

I have a .NET Core 2.0 app using the Angular 2 Template. The problem is that I can't add a custom font (woff2) to the app.component.css @font-face { font-family: 'FrutigerBold'; src: url('./assets/fonts/frutiger65_bold.woff2') format('woff2'); } And get the following error: NodeInvocationException:...
1

votes
0

answer
67

Views

Refresh user's permissions after removed from a role

I have a project where I can assign users to roles. My problem is that when I remove a user from a role, the user will be able to access the resources that he is no loger supposed to see. The only way to refresh his permissions is when he log off and login again. This is a problem because when I wan...
pitaridis
1

votes
1

answer
301

Views

DotNetCore.NPOI & .Net Core 2 MVC Web App

I am using DotNetCore.NPOI V1.0.2 in my .NET Core 2 MVC web app. I have been researching for instructions or examples to create .docx document with header and footer without any success. Does anyone know how to create two lines header and footer with page numbers like Page 1/x format?
Charles Yang
1

votes
0

answer
268

Views

Creating recursive method helper with Func<>

I have two method helper with theses signatures: @helper CreateNavigation(int parentId, int depthNavigation) @helper Navigation(int parentId, int depthNavigation) I have tried to convert it to a proper method for using in ASP.NET Core 2. But I got an error in VS2017 IDE that is: 1- Use of unassigne...
Jahan
1

votes
0

answer
347

Views

LinkedIn Authentication using OAuth2.0 in ASP.NET Core 2.0

I am trying to use the LinkedIn authentication in my asp.net core 2.0 app. I am following this article as an example, but its using Core 1.0: Authenticating a user with LinkedIn in ASP.NET Core Some of the code updates to move to Core 2.0 I have made are in the registration of the middleware: publi...
Reza
1

votes
0

answer
485

Views

How to create user defined functions using code first in ABP?

I want to create some user-defined functions using code first approach in abp framework. I have created stored procedures xyz by adding xyz.sql inside EntityFrameworkCore\Migrations\Stored Procedures folder, But not able to find a way to create a function, please help.
vivek nuna
1

votes
1

answer
482

Views

Asp.Net Core Azure AD V1.0 JWT Authentication Invalid Signature

I have to make an ASP.NET Core 2.0 Web API application which uses the resources of Microsoft Graph. I tried to make the app use JWT authentication with the following properties: Audience: 'CLIENT_ID'; Authority: 'https://login.microsoftonline.com/TENANT_ID' The idea here is that I have a SPA app whi...
Abraxas
1

votes
0

answer
245

Views

Bootstrap navbar styling issue in ASP.NET Core Web Application template

Did anyone else notice that for the longest time there has been a bug in the _LoginPartial.cshtml of the ASP.NET Core Web Application template (w/ Individual User Accounts)? Hello @UserManager.GetUserName(User)! Log out The navbar-right class being on both the form and ul elements causes a margin is...
Blake Rivell
1

votes
0

answer
129

Views

How do I get the model state from a HTTPRequestResponse from within a console application

I have an APS.NET Core 2.0 API that I am writing a test client for. The test client is a console application. I want to be able to read and display any errors returned from may API call that would be in the model state. In my API, if the model is not valid, I return the model along with a status 422...
EiEiGuy
1

votes
2

answer
356

Views

ASP.Net Core - EntityFrameworkCore data is not adding, updating instead

I am using ASP.Net Core 2 and Entity Framework Core with MySQL. I want to add a simple entity to the database. My Model is like this- public class Employee { public int Id { get; set; } [Required] public string Name { get; set; } [Required] public string City { get; set; } [Required] public string D...
IT Eng - BU
1

votes
2

answer
749

Views

Is there a way to deserialize CSV to object, mapping by varied column names?

I would like to deserialize CSVs to objects, mapping by varied column names, as illustrated by the following examples: Input 1 Id;Name;Document 1;Matheus;555777 2;Clarice;567890 Input 2 'Id_Person';'First_Name';'Phone' 3;'John';'999-9999' public class People { public int PersonId { get; set; } publi...
Matheus Lacerda
1

votes
1

answer
231

Views

Referencing .NET 4.7.1 library using Azure Storage from ASP.NET Core 2 MVC App

In my solution I have an ASP.NET Core 2 MVC app using Razor pages, a Web API 2 app and a .NET 4.7.1 class library containing services and their definitions that use Azure Table Storage from the Azure Storage NuGet (v8.7.0). I'm using autofac for dependency injection. I have hooked up both my web app...
James Mundy
1

votes
0

answer
43

Views

Precompiled Views and CompilationCallback

I've defined a compilation callback for my MVC views like var mvc = services.AddMvc(); mvc.AddRazorOptions(razorSetup => { razorSetup.CompilationCallback = context => { // context.Compilation = context.Compilation.AddReferences(...) }; }); This works great - and while debugging, there's no problem -...
Wolfgang Kluge
1

votes
0

answer
1.2k

Views

Could not load type 'Microsoft.EntityFrameworkCore.Infrastructure.DesignTimeProviderServicesAttribute'

I use Visual Studio for Mac, created a .net core web api project. The csproj file is like this: netcoreapp2.0 When I execute 'dotnet ef dbcontext scaffold' to scaffold from MySQL with the following command: dotnet ef dbcontext scaffold 'server=[server];port=3306;user=[user];password=[password];datab...
Ternence.Lin
1

votes
0

answer
104

Views

How to add an asmx service in asp.net core 2.0 and access it from javascript

I'm trying to add a asmx service to an asp.net core 2.0 application. First it doesn't allow me to add a new asmx service (since it's a .net core application). So I did Add Existing Item and added an existing asmx service. But I'm unable to access it from javascript. It gives a 404 error in the brows...
AbdiasM
1

votes
0

answer
285

Views

.Net Core 2.0 custom authenticantion: pass logged user id to controller

Our company has a custom authentication scheme that I have to use. In my .NET Core 2.0 Web API I will receive a token in each requisition and resend it to a validation service. I'm currently using an overridden HandleAuthenticateAsync, and if the validation checks out, I need to somehow send the use...
Matheus Lacerda
1

votes
1

answer
790

Views

Role authorization in .net core 2.0 using Identity

I am using .net core 2.0 and trying to do authorization using asp identity in a mvc website. (Authentication is done using Google OAuth). Authentication is working fine i.e users can access controllers/views after logging in through google. But when I try adding a role('Admin') to a particular contr...
vicky99
1

votes
0

answer
196

Views

Asp.Net Core Integration with Identity Server 4 Token Server

I'm implementing jwt implicit authentication from Identity Server 4 in a new ASP.NET Core 2.0 Application, but confused on how to get my claims set on the context. services.AddAuthentication(options => { options.DefaultAuthenticateScheme = IdentityServerAuthenticationDefaults.AuthenticationScheme; o...
johnny 5
1

votes
1

answer
374

Views

How to access Model object in ActionFilterAttribute.OnResultExecuted?

I am working with a WEB API application in ASP .NET Core 2.0 where I have a custom filter attribute that inherits from ActionFilterAttribute. How can I access the Model object passed to a controller action in POST call, in ActionFilterAttribute.OnResultExecuted() The mentioned method is passed a Res...
Farooq Hanif
1

votes
1

answer
511

Views

Can not find compilation library location for package 'NReco.PdfGenerator'

I am trying to use NRecosite HTML to PDF generator. Whenever it comes to new NReco.PdfGenerator.HtmlToPdfConverter() it throws exception FileNotFoundException: Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find t...
maxspan
1

votes
2

answer
243

Views

Taghelper not rendering after upgrade to asp.net core 2.0

I have upgraded my application to asp.net core 2.0 and now my taghelpers are not rendering. I have made no change in my code. Below is my _ViewImport.cshtml and labeltaghelper.cs. Also while doing build I am getting warning 'Microsoft.AspNet.Mvc.TagHelpers 6.0.0-rc1-final' was restored using '.NETF...
maxspan
1

votes
1

answer
887

Views

getting exception System.Runtime.Remoting.ObjectHandle while using XMLWorkerHelper in asp.netcore 2.0 with Itextsharp

I am trying to use ItextSharp to generate pdf but I am getting a exception on XMLWorkerHelper.GetInstance().ParseXHtml(writer, pdfDoc, sr); MissingMethodException: Method not found: 'System.Runtime.Remoting.ObjectHandle System.Activator.CreateInstance(System.String, System.String)'. What am I missi...
maxspan
1

votes
1

answer
837

Views

Slow response from Identity Server 4.0 (asp.net core 2.0) on connect/token endpoint on high load

We have setup Identity Server 4 with Entity Framework Core. We successfully created and Seeded the desired Client to the MSSQL Database and deployed both the Project and the Database to one and the same AWS Datacenter. In our Startup.cs class we have: .AddInMemoryCaching() .AddClientStoreCache() ....
Mariyan Stefanov
1

votes
0

answer
132

Views

ASP.NET Core 2 multi-authentication methods

I'm trying to do what seems to me a common use case, but I cannot find much documentation or examples. I have a website that has a UI and a set of web services which would only be accessed by other applications. Users log into the UI using AzureAD (though I would also like to have users that don't h...
Zack
1

votes
0

answer
77

Views

.Net Core 2.0 Publish Error Angular SPA

I am having an issue when publishing my .Net Core 2.0 Angular SPA from Visual Studio 2017 Community. The site compiles and runs fine through the debugger. When I try to publish (to ftp) I get the following error; The command 'node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js...
Matthew Flynn
1

votes
0

answer
274

Views

Can the Asp.Net Core Data Protection System detect the configuration has changed and generate a new key?

I'm creating a new asp.net core 2 website that's using data protection as per this article. As a first pass I created this without protecting the keys (since we're not in production yet) e.g. public void ConfigureServices(IServiceCollection services) { services.AddDataProtection() .PersistKeysToFile...
Gavin Sutherland

View additional questions