asp.net-core-2.0

How Do I Pass an Array of Values via Anchor Tag Helper?

流过昼夜 提交于 2019-12-13 07:52:52
问题 I'm using Asp.Net Core 2.1 Pages public async Task OnGetAsync([FromQuery(Name = "status")] string[] myValues) { } I'm trying to pass in an array of values from an anchor tag helper , but all I receive in myValues is one item. If I manually type out the query string to mirror MyRoute?myValues=A&myValues=B , it works as expected. I've tried the following with no success. <a asp-page="/MyPage" asp-route-status="A" asp-route-status="B">Click</a> <a asp-page="/MyPage" asp-route-status="new [] { A,

Download excel file with .Net core 2 and EPPlus

人走茶凉 提交于 2019-12-13 04:16:22
问题 From an api route : api/exportExcel, i want to generate an excel file with .netCore 2.0 and EPPlus so the user can download it on his machine but the file is not generated and i have no server error. On the other hand, i have a binary content in the response : PK!rNäH­¯3[Content_Types].xmlµÏJ1Æ_eÉU´D, etc... Here's my code : [HttpPost("exportBooks")] public FileResult ExportBooks([FromBody] Books[] books) { var comlumHeadrs = new string[] { "Book Id", "Name", }; byte[] result; using (var

Get Job info (Job title, Department and Manager ID) from Azure AD in Claims

南楼画角 提交于 2019-12-13 03:53:50
问题 I have been reading the Azure Active Directory application manifest but I have not seen anything regarding job info. https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-application-manifest I was able to add groups to claims like the answer below but I have not been able to get job info. Is this possible? https://stackoverflow.com/a/50836460/3850405 If I log into https://portal.azure.com and look at my user in Azure Active Directory I can see the information. I

(System.IO.FileNotFoundException) .Net core Web API cannot find child dependency (Dependencies of dependency) when added DLL by “Add Reference”

蹲街弑〆低调 提交于 2019-12-13 03:45:11
问题 I am getting System.IO.FileNotFoundException in my .Net Core Web API. So I've set up the below project to demonstrate the problem. I created a.Net Standard library named DemoLibrary and added QRCoder dependency via NuGet. Disclaimer: Reason for choosing the QRCoder is that the Web API doesn't use it by default. I don't use it in my project. In fact, I'm getting this exception for EntityFrameworkCore. I created a new .Net Core Web API DemoWebAPI which has no other dependencies. Then added the

Make Angular routes work inside ASP.NET Core 2.0 app

◇◆丶佛笑我妖孽 提交于 2019-12-13 03:37:41
问题 I have an ASP.NET Core 2.0 app and I have Angular 5 app. Those are developed separately (1st in VS2017, 2nd in VS Code). So I set up CD/CI in VSTS and Angular app gets injected into /angularapp/ folder of ASP.NET Core app during the build. In order to make angular app work when user opens http://domain/angularapp I set up URL rewrite rule in IIS (so when it hits /angularapp it gets rewritten to /angularapp/index.html). But what about deeper links in Angular app? If I try to open /angularapp

UseLibuv option gone after changing Microsoft.aspnetcore.all to Microsoft.NETCore.App in .net core 2.1.6

末鹿安然 提交于 2019-12-13 03:31:08
问题 I am using asp.net core 2.1.6 I have just changed my Microsoft.aspnetcore.all to Microsoft.NETCore.App as publishing the web api project is making too much size. In my code i were using use UseLibuv(o => o.ThreadCount = 1000) to set minmum thread count public static IWebHostBuilder BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<StartupShutdownHandler>() //.UseLibuv(o => o.ThreadCount = 1000) ; Now this option is not coming. How can i set min threads now like old

Updating common field with user email

倾然丶 夕夏残阳落幕 提交于 2019-12-13 03:19:26
问题 I am trying to find out what the authorized user is currently trying to save the data and record their email. I have a basic setup in my dbcontext that does the update for timestamps but i cannot figure out how to access the user information: public override int SaveChanges() { AddTimestamps(); return base.SaveChanges(); } public override async Task<int> SaveChangesAsync() { AddTimestamps(); return await base.SaveChangesAsync(); } private void AddTimestamps() { var entities = ChangeTracker

ASP .NET Core 2.0 - OpenId Connect Auth : Correlation error

♀尐吖头ヾ 提交于 2019-12-13 02:58:37
问题 I am trying to create an authentication on an ASP.NET Core 2.0 web app. My company is using Ping Federate and I am trying to authenticate my users using the company login page and in return validating the returned token using my signing key ( X509SecurityKey down here). The ping login link link looks like: https://auth.companyname.com I configured the Startup.cs to be able to log in and challenge against this site. I decorated my HomeController with a [Authorize(Policy="Mvc")] . I am able to

Recursion in a table using razor in ASP.NET Core

你说的曾经没有我的故事 提交于 2019-12-13 02:57:30
问题 I have this product category model: public class ProductCategory { public int Id { get; set; } public int? ParentId { get; set; } public string Title { get; set; } } Using the parent Id, I want to display a list of categories and sub-categories (max three levels) in a tabeled list, like so: <table> <tr><td colspan="3">Category #1</td></tr> <tr><td></td><td>Category #1.1</td><td></td></tr> <tr><td></td><td>Category #1.2</td><td></td></tr> <tr><td colspan="2"></td><td>Category #1.2.1</td></tr>

Razor Pages On Server Validation returning for without some fields

落花浮王杯 提交于 2019-12-13 02:36:55
问题 I'm having an issue with a server side validation with Razor Pages (ASP.Net Core 2.0) I have a page that creates a record http://localhost:56876/Entries/Create?employeeID=112345 my code behind file for the OnGet looks like: [BindProperty] public EntryLog EntryLog { get; set; } public Employee Employee{ get; set; } public string empID { get; set; } public IActionResult OnGet(string employeeID) { empID = employeeID; // for Selects for lookup tables ViewData["ReasonId"] = new SelectList(_context