Questions tagged [asp.net]

233620 questions
1

votes
1

answer
29

Views

can't connect to method in the controller

I'm using asp.net web api. I'm trying to have a positive response from the server, however program is not seeing one of the methods in the controller. It goes into the controller constructor, but not further. The response is Status Code 404, Reason Phrase: Not Found. I understand that it can be a...
Alice
0

votes
1

answer
26

Views

How to call an implemented interface method with different return types? [duplicate]

This question already has an answer here: Does C# support return type covariance? 9 answers I've an interface that has one method with an Interface return type. Is there a way to implement that method in different classes with different return types (derived from the interface return type)? This is...
Phoenix_uy
2

votes
1

answer
110

Views

Trying to make epaper dynamic using C# asp.net web form

I have static e paper but i want to develop dynamic e-paper like below url https://epaper.dawn.com/?page=15_04_2019_001 I have no idea to start e paper dynamic below is my whole html code q Times body { background-color: #fafafa; min-height: 100vh;} .container { margin: 200px auto; max-width: 600px;...
mohd mazhar khan
-4

votes
0

answer
8

Views

how to prevent download file from websites [on hold]

I have try and searched lot of way to prevent the file download options from my web application .But i unable to do it .Anybody known , If is it possible please share the details to me.
somu
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
2

answer
1.5k

Views

SessionID keeps changing in ASP.NET Core web api

I am using Angular 2 as front end and Asp.net Core Web API as server side.my problem is when i am trying to maintain session in HttpContext.Session ,But for every request the Session Id is Changing and the data has been lost,Know i want to Manage session in server side Is it possible to maintain ses...
Riyaz Ahamed
1

votes
2

answer
376

Views

Dynamically return fields from a web method

I have a WebAPI service where I would like to allow users to specify which fields they'd like returned. For example, say I have the following Person class: public class Person { public string FirstName { get; set; } public string LastName { get; set; } public string Email { get; set; } } and that ca...
Phillip Copley
1

votes
1

answer
869

Views

Breakpoint failed to bind error when debugging .NET framework code?

I'm trying to debug System.Security.Cryptography.Xml.SignedXml and related classes in Visual Studio 2015, but I consistently see lines in the core framework code being skipped while stepping through in the debugger. Unfortunately, the lines that are skipped include the lines I need to debug. Has any...
The Velcromancer
1

votes
3

answer
4.5k

Views

.net core cross platform desktop app

I'd like to develop a cross platform desktop app by using .net Core. The app needs to be executed on linux, mac os, and windows. For that purpose, should i create a console app and put below lines in settings xml? win10-x64;osx.10.12-x64;debian.8-x64 Will it be sufficient? If so, should i write all...
Dilara Albayrak
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
1

answer
1.1k

Views

SingalR Error during negotiation request

I've got a project with SignalR and AspNet. I'm trying to connect my client (its a cors) and the first request returns 200 code but I'm getting this error in my client side: Error during negotiation request. My SignalR Server side classes: public class Startup1 { public void Configuration(IAppBuilde...
patricia
1

votes
1

answer
238

Views

Cannot Scaffold (EF, Core 2.1) model that contains a 'bool' item

My model looks like this: namespace Flow.Models { public abstract class Project { public int ID { get; set; } public String HashID { get; set; } public string FileLoc { get; set; } //Use HashedID above. public bool Network { get; set; } public int ClientID { get; set; } public int FirmID { get;...
user1489765
1

votes
2

answer
928

Views

Changing B2C Reply URL from “signin-oidc” to something else does not work

I am trying to get a ASP.NET Core 2.1 web app running with Azure AD B2C. I have this running after much reseach (and more trial and error) as the instructions found in the docs are a little off. The sign-in/sign-up process works using the default scaffolding during the project setup wizard, plus the...
John
0

votes
1

answer
13

Views

Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only support

I am going to receive an object like the following: BOI BOI SBH SBH BOI 2234682 bsnl 1116 SCIENTIST 'E' B Rama Krishna Reddy 51910 false A- N 01-07-1958 00:00:00 B Pulla Reddy(Late) M M and here is my interface export interface IEmployeePersonalInformation { EmployeeCode: string; EmployeeName: strin...
rammi
0

votes
0

answer
13

Views

How to bring another project (get,post) api method to swagger api project?

I've created one API project with asp.net core in which I used swashbuckle.AspNetCore dll to generate swagger. It is working perfectly and going well. Now I have another c#(.net standard library) in which I have created some GET, POST, DELETE, PUT method. Need to load all of those methods to the swa...
sk5202
0

votes
0

answer
12

Views

Force inner join from EF Cores Include() on optional relationship

We changed a relationship from required to optional, now the resulting SQL produced by EF Core's Include() does a left outer join rather than inner join. Problem is that those optional entities have query filters on them that is required. Let's say we have the following; public class First { public...
HenrikM
1

votes
0

answer
10

Views

How to Fix “ The model item passed into the dictionary is of type but this dictionary requires a model item of type ”

I want to make paging in the table using Pagedlist and get an error The model item passed into the dictionary is of type 'PagedList.PagedList1[System.Collections.Generic.KeyValuePair2[MyProject.Data.Models.User,System.Collections.Generic.IEnumerable`1[MyProject.Data.Models.Role]]]', but this dictio...
chaeusang chen
1

votes
0

answer
9

Views

The selector “app-root” did not match any elements after update to Angular 7

After updating the client app of an ASP.Net Core MVC SPA-project from Angular 5.2 to Angular 7, I receive the following runtime error when loading the app from index.html: The selector 'app-root' did not match any elements at DefaultDomRenderer2.push../node_modules/@angular/platform-browser/fesm5/pl...
Marc
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
670

Views

Which files to publish? ASP .Net Core 2.0

I'm working on hosting my first ever Asp.net core 2.0 website. To bundle the project I ran 'dotnet publish' This created the following folder structure for publish: /wwwroot /appsettings.Development.json /appsettings.json /ProjectName.deps.json /ProjectName.dll /ProjectName.pdb /ProjectName.PreCompi...
Richard Smith
1

votes
2

answer
192

Views

Options for controlling Destructuring of request object

I've run into a problem that I'm struggling to find a clean solution for, and Googling has not made me any wiser. The situation (1) We have our own assembly for setting up and adding a Serilog logger to any of our projects (consistent logging output, theme, etc) and this assembly has no references t...
Mashton
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
2

answer
713

Views

HttpContext.Features vs HttpContext.Items In Asp.Net Core

What is the differences between this two Properties? I can use HttpContext.Items instead of HttpContext.Features to share data between middlewares. The only difference i see is that i tell Items for a key and it gives me object and i have to cast it. This casting can be done in Features automaticall...
Mohammad Barbast
1

votes
3

answer
2.4k

Views

dotnet build - get error “could not return the default page '/index.html'”

try to generate my project into exe file, but get error: before: 'dotnet build -r win10-x86' is ok after run generated exe, all is ok also: indows DPAPI to encrypt keys at rest. Hosting environment: Production Content root path: C:....\currencyColution\correncyProject\bin\Debug\netcoreapp2.1\win10-x...
Max990
1

votes
2

answer
654

Views

ASP.NET Core ViewData, BindProperty or TempData?

In ASP.NET Core Views and Razor Pages we can use: public class LoginModel { [BindProperty] public bool DisplayCaptcha { get; set; } // OR [ViewData] public bool DisplayCaptcha { get; set; } // OR [TempData] public bool DisplayCaptcha { get; set; } } To share data between View/Page/Controller... But...
Vanderlei Pires
1

votes
1

answer
1.8k

Views

My ASP.NET Core app says it can't read web.config

I get this error when I access my app which I published to local IIS: HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. My web.config is really simple: What could be wrong? I tried giving all users permissi...
ekolis
1

votes
1

answer
173

Views

Where is the ClaimsIdentity information stored after calling AuthenticationManager.SignIn() using CookieAuthenticationProvider

We are using the Microsoft.Owin.Security.Cookies.CookieAuthenticationProvider in an ASP.Net MVC web application. The 'sign in' code uses a custom class that keeps track of authorization info (userRights in the example below). The code looks like this: string auth = JsonConvert.SerializeObject(userRi...
Louis Somers
1

votes
1

answer
456

Views

asp.net core 2.1 with knockout

I've been trying to teach myself the ins and outs of .NET Core development, and I've got the start of a Core 2.1 web application created. I've even gotten the hang of EF Core, and have a working DB Context. I am, however, having difficulty figuring out how to implement knockout. I ran the command do...
Kurt
1

votes
2

answer
699

Views

asp.net core hosted service sleeps after api inactivity

I have a hosted service that checks an email account every minute. I also am using MVC with Web API 2.1. In order to get my hosted service to start, I have to 'wake it up' by calling API methods. After a period of inactivity from the Web API the hosted service goes to sleep and stops checking the...
Cindy Hoskins
1

votes
1

answer
607

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 following way: ConfigureServices method: services.AddCors( options => { options.AddPolicy( 'AllowCors',...
Pylyp Lebediev
1

votes
1

answer
249

Views

TempData isn't persisting data on Production Server [ASP.NET CORE 2.1]

I have an issue and I have searched the docs to see maybe I made a mistake or something but didn't find the answer that I was looking for. My issue is this, After saving a product, I use the PRG(Post-Redirect-Get) pattern so the user doesn't resubmit the form when pressing the browser back button. I...
umeh oscar
1

votes
1

answer
528

Views

ASP.NET Core: IConfigurationBuilder Does Not Contain Definition For AddAzureKeyVault

I am upgrading my ASP.NET Core web app to .NET Core 2.1, but am getting the following error: IConfigurationBuilder Does Not Contain Definition For AddAzureKeyVault This code works in .NET Core 2.0. It looks like a library is missing in .NET Core 2.1. using System; using Microsoft.AspNetCore; using M...
Brandon Minnick
1

votes
1

answer
223

Views

Override AccountController in Individual User Accounts

I've created in Asp .Net Core 2.1 - mvc Individual User Accounts and add scaffold identity. I need override route Identity/Account/Register to Account/Register. I guess I need access in AccountController and add attr [Route('')]. How can i do it?. In advance thanks for help.
nikita Abramov
1

votes
1

answer
219

Views

How to copy a csproj file using docker without visual studio and without docker compose?

I just started a new solution with a .NET Core Project (2.1) using visual studio 15.8.8. It can run and debug it by setting the docker compose file as a startup project. It works! Logically, I should be able to build the docker image with a simple commandline statement. However, it complains that th...
Daan
1

votes
1

answer
960

Views

How to update appsettings.json based on publish profile using .NET Core?

I'm currently making the switch from .NET Framework to .NET Core. In the past, all of my application settings were in the Web.config file. When I added a new publish profile, I could right click and select 'Add Config Transform' which would generate a nested Web.{Profile}.config file under Web.confi...
Matthew
1

votes
2

answer
494

Views

Change Id type of asp.net core 2.2 IdentityUser

I'm new to dot-net core 2.x, so... I would like to change the type of the Id in asp.net core 2.2 IdentityUser from string to int. All the examples I've found via google (and the stackoverflow search facility) are giving me examples of asp.net core 2.0 which provides an ApplicationUser when you scaff...
Owen
1

votes
1

answer
458

Views

Configure log4net AdoNetAppender in asp.net core application

I am trying to configure log4net using MicroKnights AdoNetAppender(nuget 3rd party library) for my asp.net core application. However nothing is getting logged in database. Also I am not getting any errors when running the application. I suspect the connectionType is causing the trouble. log4net conf...
user2443401
1

votes
1

answer
454

Views

ASP.NET Core 2.1 Role Manager Register

In my seeding code I create Users and Roles, and the error seems to be whenever I run it through startup I seem to be getting 'No service for type Microsoft.AspNetCore.Identity.RoleManager'1[Microsoft.AspNetCore.Identity.IdentityRole] has been registered. EDIT*** I think the issue is that the code...
OCTAVIAN
0

votes
0

answer
9

Views

Classic ASP connection works; .Net fails. Why?

This works in a Classic ASP Web site: sConnString = 'Provider=SQLOLEDB;Data Source=MySerer;Initial Catalog=MyDB;Integrated Security=SSPI;' In a .Net web site, the following connection string gets a 'Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'' error. Both run in the same Application Pool on...
Scott Pendleton
0

votes
1

answer
12

Views

How to get hyperlink in a formula using EPPlus

I need to get the exact link inside the formula(HYPERLINK) and save it to the database. here is my code to get the link, answerList.Add(new SurveyCompetitorAnswer { MainSurveyId = id, Answer = workSheet.Cells[AnswerRowRange].Text, DateCreated = DateTime.Now, Link = workSheet.Cells[AnswerRowRange].F...
Chris May

View additional questions