asp.net-core-mvc

does not support framework .NETCoreApp,Version=v1.0

狂风中的少年 提交于 2019-12-12 04:34:12
问题 Getting blowout trying to create and run a asp.net core (.net core) blank or web template. I've have vs2015 update3 and .net core 1.0.1 tools preview 2 installed. After creation I receive Package Restore Failed in my solution manager. Errors list has lots of NU1002 errors of ilk of "The dependency System.Security.Principal.Windows 4.0.0 does not support framework .NETCoreApp,Version=v1.0" Output window has similar stuff. Help.... NUGET.CONFIG Does not exist in project directory. {

ASP.NET MVC Core: Error occurs after adding IdentityUser

拜拜、爱过 提交于 2019-12-12 04:32:06
问题 I'm learning to build a ASP.NET MVC Core web application. Everything works fine until I start to add Identity to it. Registered User can create many Jobs . I use the ApplicationUser.cs that comes with the project for the User . I created another DbContext for all others entities. ApplicationUser.cs in Model: public class ApplicationUser : IdentityUser { // CUSTOM PROPERTIES public string Name { get; set; } public ICollection<Job> Jobs { get; set; } } Job.cs in Model: public class Job { public

How secure the EntityId in hidden field for Editing Form in Asp.Net Core MVC?

那年仲夏 提交于 2019-12-12 04:23:22
问题 I'd like to create the form for editing some Entity (for example a post) in the database using the Entity Framework Core. I want to protect the value PostId in the hidden field before rewriting to another value from the browser. I'm wondering about checking the user permissions before updating but I want to create some encryption/signing or something like that. How can I encrypt or sign the PostId and in the controller decrypt or validate it? I've created the example form for editing the post

“The 'prepublish' script failed with status code 34”

江枫思渺然 提交于 2019-12-12 04:05:49
问题 I can successfully build and run my project both in Debug and Release mode. However when I want to publish to a server shared folder or just a local folder I get the following error in my console. "The 'prepublish' script failed with status code 34" I am using Visual Studio 2015 update 1. ASP.NET 5 RC 1 Update 1 Here are my publish options Both the 32 bit and 64 bit options gives the same error 回答1: I removed the following section from my project.json "scripts": { "prepublish": [ "npm install

.NET Core serving HTML file outside wwwroot can't load JS files

江枫思渺然 提交于 2019-12-12 04:03:50
问题 I am experimenting with different ways to secure an Angular CLI app with .NET Core Authorization. To make it as secure as possible, I would like to keep all of the Angular CLI output files from being publicly available and keep them in the default "dist" folder preconfigured by the CLI. I can load the index.html from an authorized controller by returning a PhysicalFileResult... public IActionResult Index() { return PhysicalFile(Path.Combine(Directory.GetCurrentDirectory(), "dist", "index.html

ModelValidation on posted action parameter not happening

与世无争的帅哥 提交于 2019-12-12 04:02:57
问题 Why doesn't ASP.NET Core validate [FromBody] attributed action parameters? In the example below the paramter value of type SomeClass does not get validated. It doesn't even appear in the ModelState dictionary (only id ). this.ModelState.IsValid is always true , even though the Name property is set to a string longer than 2 letters. Even TryValidateModel is always true no matter what the request body contains (JSON). Sample Repo here public class Startup { public IConfigurationRoot

access dbcontext in custom Newtonsoft JsonConverter class

限于喜欢 提交于 2019-12-12 03:56:43
问题 I created an JsonConverter for mapping children entitys to list of ids in json for example childrens:[1,2,3] public class IdsJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) { return objectType==typeof(ICollection); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { //problem convert ids back to entities because i can not get db context here so I unable to get the tracked entities from

Passing Data from View to Partial in .NET CORE

只谈情不闲聊 提交于 2019-12-12 03:52:43
问题 I read this and tried to implement the ViewDataDictionary in my app but did not work. In my view, I've the below code: @{ var myTest = new { UserId = "cdb86aea-e3d6-4fdd-9b7f-55e12b710f78", UserName = "iggy", }; } @Html.Partial("~/Partials/test.cshtml", myTest) and the test.cshtml is very simple, when I write @Model , I get { UserId = cdb86aea-e3d6-4fdd-9b7f-55e12b710f78, UserName = iggy } How can I extract this as JSON, so I can read @Model.UserName I tried using: <script type="text

Docker container with ASP.NET Core libraries

我是研究僧i 提交于 2019-12-12 03:46:22
问题 Each time I build Dockerfile with ASP.NET Core application it's download assemblies from web Nuget store. Basically I'd like to create docker image with all this ASP.NET Core libraries (and probably some libraries I usually use). From my understanding I trying to reinvent GAC. So, my question is it possible to use something like GAC for ASP.NET Core? Or, my second thought, download ASP.NET Core libraries to container and then resolve it locally somehow. My goal is to reduse time for building

aspnetcore-spa (webpack) - when used in separate project builds unwanted js files

放肆的年华 提交于 2019-12-12 03:37:26
问题 I have a questions in regards to the aspnetcore-spa functionality. What im trying to do is to implement it based on the sample project from yeoman (with angular2) in a SEPARATE project. But im running into an issue with i suspect is caused by some missing configuration or something. To explain what i do the following procedure illustrates the problem: I generated a sample project using 'yo aspnetcore-spa' and selected angular2. I created an empty .net core project. I copied over the, as i