asp.net-mvc-5

Authenticate a USER in Asp.net MVC 5 without password

↘锁芯ラ 提交于 2020-01-06 14:53:29
问题 I want to authenticate a user with only user name and no password. My application does not have any user management data and I just want to create Identity with user details so that I can use it in the application. I tried to copy the SingInAsync method to put this up private async Task InitializeUser() { var user = new ApplicationUser(); user.Id = "abcd"; user.UserName = "abcd"; AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); var identity = await UserManager

model binding html:asp not working

纵然是瞬间 提交于 2020-01-06 13:50:29
问题 I made a dynamic textarea 's group that are added in DOM dynamically by using JS . Those textarea 's, I want them in the controller , indeed. I receive null values in the model.actionLis t with that code: Here is the HTML generated: <div class="input_fields_wrap"> <div><textarea class="form-control text-box multi-line" name="model.actionList[1].probleme"></textarea> <textarea class="form-control text-box multi-line" name="model.actionList[1].action"></textarea></div> <div><textarea class=

ERROR: EntityFramework.dll not found after I installed Entity Framework 6.1.3

落爺英雄遲暮 提交于 2020-01-06 12:13:10
问题 How can I resolve this error? I have added the Entity Framework 6.1.3 from this link: Download EntityFramework 6.1.3 for Visual Studio 2013 (after uninstalling and re-installing it again and again) Now that it has been added and in the project created a .emdx file using ADO.NET Entity Data Model . When I try to build it, the following error pops: EntityFramework.dll not found (after Compilation) 回答1: Don't uninstall the Visual Studio. Installing the Entity Framework 6 Tools for Visual Studio,

Using Razor to create a form for hierarchy of domain models

那年仲夏 提交于 2020-01-06 10:40:53
问题 Lets say I have the following classes (could you also consider if my classes in terms of that relation part is correct): public class EFDbContext : DbContext { public DbSet<Project> Projects { get; set; } public DbSet<Address> Addresses { get; set; } // * public DbSet<Country> Countries { get; set; } // * // Custom model builder bindings for * coz of the plural issue with EF } public class Project { public int ProjectID { get; set; } public string Name { get ; set; } public int AddressID {

Using Razor to create a form for hierarchy of domain models

…衆ロ難τιáo~ 提交于 2020-01-06 10:39:27
问题 Lets say I have the following classes (could you also consider if my classes in terms of that relation part is correct): public class EFDbContext : DbContext { public DbSet<Project> Projects { get; set; } public DbSet<Address> Addresses { get; set; } // * public DbSet<Country> Countries { get; set; } // * // Custom model builder bindings for * coz of the plural issue with EF } public class Project { public int ProjectID { get; set; } public string Name { get ; set; } public int AddressID {

How can I get all logged-in users on my website?

佐手、 提交于 2020-01-06 06:51:25
问题 I need all active users logged on my website. I know I can take my logged-in user: var currentUser = manager.FindById(User.Identity.GetUserId()); but how can I take all? 回答1: ASP.NET membership has a feature that works for FormsAuthentication. Otherwise you need to write to a persistent store somewhere the most recent activity date & then query that table for all users active within a certain window. A web app is stateless, so "actively logged" in is a fictional abstraction we imagine over a

How can I get all logged-in users on my website?

廉价感情. 提交于 2020-01-06 06:51:07
问题 I need all active users logged on my website. I know I can take my logged-in user: var currentUser = manager.FindById(User.Identity.GetUserId()); but how can I take all? 回答1: ASP.NET membership has a feature that works for FormsAuthentication. Otherwise you need to write to a persistent store somewhere the most recent activity date & then query that table for all users active within a certain window. A web app is stateless, so "actively logged" in is a fictional abstraction we imagine over a

“0x800a1391 - JavaScript runtime error: 'jQuery' is undefined” Error

爷,独闯天下 提交于 2020-01-06 05:09:06
问题 Please bear with me on the backstory as it may be pertinent to what the issue is: So I'm trying to learn ASP.NET MVC 5 and I learn best starting with nothing and slowly building up. The best tutorial I have been able to find that follows this is the MVC 3 ASP.NET tutorial for setting up a record store. So I stripped out everything of a basic MVC 5 to the bare minimum to get a page returned to me and then started following the tutorials. There were only a few hiccups that I was able to

Get Current User after SignInStatus.Success

会有一股神秘感。 提交于 2020-01-06 03:42:06
问题 I have a mvc app and I´m using Asp Identity 2.0. I need to change some User information after the login, so I need to get the current user just after login. I´m using the following code var user = UserManager.FindById(User.Identity.GetUserId()); Just after case SignInStatus.Success: But I´m getting null as result. Usually when I use UserManager.FindById(User.Identity.GetUserId()) in the Controllers it works fine. Don´t know what is happening now. 来源: https://stackoverflow.com/questions

Get Current User after SignInStatus.Success

淺唱寂寞╮ 提交于 2020-01-06 03:42:05
问题 I have a mvc app and I´m using Asp Identity 2.0. I need to change some User information after the login, so I need to get the current user just after login. I´m using the following code var user = UserManager.FindById(User.Identity.GetUserId()); Just after case SignInStatus.Success: But I´m getting null as result. Usually when I use UserManager.FindById(User.Identity.GetUserId()) in the Controllers it works fine. Don´t know what is happening now. 来源: https://stackoverflow.com/questions