asp.net-core-mvc

How to retrieve facebook user profile picture within asp.net core MVC RC2

随声附和 提交于 2019-12-04 13:40:46
Using ASP.NET Core MVC RC2 I am trying to retrieve the Facebook user profile picture. To do this I have the following lines in the Configure method of the Startup class app.UseFacebookAuthentication(new FacebookOptions() { AppId = Configuration["Authentication:Facebook:AppId"], AppSecret = Configuration["Authentication:Facebook:AppSecret"], Scope = { "user_birthday" }, Fields = { "birthday", "picture" }, }); In the AccountControllers ExternalLoginCallback method I was expecting to see the data for the picture in the ClaimsPrincipal collection which can be accessed via info.Principal but I

ViewComponent in external assembly cannot be found

非 Y 不嫁゛ 提交于 2019-12-04 12:55:36
I am using the latest VS.2017 updates and templates for an MVC .NET Core web application. I decided I wanted ViewComponents in an external assembly since I read several posts that indicated it was not possible without odd tricks. I have my main web application and then I created a .NET Framework class library named MySite.Components which is the "external assembly". In it I installed the ViewFeatures NuGet. I created my View component CSHTML in its /Views/Shared/Components/GoogleAdsense/Default.cshtml. I noticed that my CSPROJ already has the GoogleAdSense as an embedded resource: <ItemGroup>

IdentityServer 4 with Active Directory on Premise

笑着哭i 提交于 2019-12-04 11:57:31
问题 Our client have many applications and they want to integrate it to just log once (single sign on), but they want that using active directory on premise they have their own server. We decided to evaluate identityserver so we found this http://docs.identityserver.io/en/latest/topics/windows.html that identitserver 4 support active directory but here we dont see where we are going to put the LPAD//... route to connect to the active directory... so we are with doubts if identityserver supports or

ASP NET Core 2 Cannot find compilation library location for package 'Projectname.Model'

若如初见. 提交于 2019-12-04 10:53:33
问题 In my solution, I have two projects. One of them is web project and the other one is Model project. You can see my solution structure in below: Now when I run application I get the following error: InvalidOperationException: Cannot find compilation library location for package 'ContosoUniversity.Model' And here is full stack trace : An unhandled exception occurred while processing the request. InvalidOperationException: Cannot find compilation library location for package 'ContosoUniversity

what is the difference between use dbset and mappers in EF7

╄→гoц情女王★ 提交于 2019-12-04 10:47:32
I started to work with .net core and Entityframework 7 in Onion Architecture ! i readed this tutorial and i think its best case for learning following subject. but one part of this tutorial made a big question inside my brain. like what you see at this linked page; at Data Layer we have some classes which are our model!! public class User : BaseEntity { public string UserName { get; set; } public string Email { get; set; } public string Password { get; set; } public virtual UserProfile UserProfile { get; set; } } public class UserProfile : BaseEntity { public string FirstName { get; set; }

ASP.NET 5 MVC6 User.GetUserId() returns incorrect id

时间秒杀一切 提交于 2019-12-04 09:47:31
I have simple project in ASP.NET 5 with one registered user. I have tried to get id of current logged user by extension method GetUserId() from using System.Security.Claims namespace. Unfortunately this method returns me not existing id and i don't know why. Here is my simple code: var currentUserId = User.GetUserId(); Method result: Database: More than likely you're getting an old auth ticket that is still valid OR your getting an authentication ticket for another site your running locally. I would clear the browser cache and cookies and run it again. Also, Try changing the name of the cookie

Entity Framework Core Migration for ASP.Net Core Class Library

三世轮回 提交于 2019-12-04 09:24:39
I've been trying to follow the advice of Ben Cull ( http://benjii.me/2016/06/entity-framework-core-migrations-for-class-library-projects ), but the database is a little different in that I'm trying to inherit from ASP.NET Core IdentityUser class. I created a new solution containing the default ASP.NET Core Web Application from the VS2015 template (CodeFirstTest). I then added an ASP.NET Core class-library (CodeFirstTest.User) to the solution, which would be the data layer in the application and where I will also be setting up ASP.NET Core Identity. Following the advice of Ben Cull, I rewrote

Save multiple rows simultaneously from the same form - dotnet core

十年热恋 提交于 2019-12-04 09:24:05
I have a table that has one empty column into which user can enter a comment: Table ----- TbMapId | UniqueAdp | Dealership | Line -------------------------------------------------------------------- 1 | [Insert comment here] | Derby | abc123 2 | [Insert comment here] | Keighley | cda345 3 | [Insert comment here] | Manchester | 876ghj There is a lot of data to comment on, I can't expect a user to open an 'Edit' page and type in a comment one by one. Instead I need user to be able to input a bunch of comments (say 20 at a time against 20 rows) and save them all at one click of submit button. If

MVC 6 install as a Windows Service (ASP.NET Core 1.0.0)

a 夏天 提交于 2019-12-04 09:02:47
问题 UPDATE - 26th July 2016 I have added the solution to this in ASP.NET Core 1.0.0 in the answers below. I have created a simple MVC 6 app and have included the Microsoft.AspNet.WebListener library so I can host outside of IIS. From project.json: "dependencies": { "Microsoft.AspNet.Server.WebListener": "1.0.0-beta4", "Microsoft.AspNet.Mvc": "6.0.0-beta4" }, "commands": { "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000" } When I

Access ASP.NET 5 View Component via URL

你。 提交于 2019-12-04 08:59:47
With the replacement of partial views in ASP.NET 5 with view components, how does one access the view components via URL? I know you call them like... @Component.Invoke("SomeList", 1) ...but what if you need to have like ajax paging, where you need a callback url to request the next set to be displayed in a partial view? So, a user can click "Load More" and it loads more from a 'partial view'. You cannot access a view component from a URL directly. A view component is just a component of a view and that view could be a regular or partial view. Based on your question, I believe you are trying