custom-membershipprovider

How to use forms authentication without login control?

狂风中的少年 提交于 2019-12-06 09:10:29
问题 How to use forms authentication without login control.I don't want to use asp.net login control in my site.But i have to implement forms authentication and to validate users in my database. 回答1: I am assuming that instead of using a login control, you are using a few textboxes(eg username/password) and a logon button. The code could look something like this: In your aspx file <asp:Textbox runat="server" ID="Username"/> <asp:Textbox runat="server" ID="Password"/> <asp:Button runat="server" ID=

How to use forms authentication without login control?

好久不见. 提交于 2019-12-04 17:43:00
How to use forms authentication without login control.I don't want to use asp.net login control in my site.But i have to implement forms authentication and to validate users in my database. I am assuming that instead of using a login control, you are using a few textboxes(eg username/password) and a logon button. The code could look something like this: In your aspx file <asp:Textbox runat="server" ID="Username"/> <asp:Textbox runat="server" ID="Password"/> <asp:Button runat="server" ID="Login" OnClick="Login_OnClick"/> <asp:Label runat="server" ID="Msg" > And on server side: public void Login

Microsoft Membership Provider Vs Custom Provider Vs Complete Custom Login System

时光总嘲笑我的痴心妄想 提交于 2019-12-03 07:32:59
问题 I am currently converting a very old, but working classic ASP site to ASP.Net. It has a completely custom written user management system. Whilst it works fine, it really needs a refresh as I want it to be more flexible for some future projects in the works. When I asked someone about this, they said "You need to use the Microsoft Provider" and gave a lecture on how Microsoft release all these things for free and how good they are and should be re used as much as possible. I have done quite a

Microsoft Membership Provider Vs Custom Provider Vs Complete Custom Login System

♀尐吖头ヾ 提交于 2019-12-02 20:17:34
I am currently converting a very old, but working classic ASP site to ASP.Net. It has a completely custom written user management system. Whilst it works fine, it really needs a refresh as I want it to be more flexible for some future projects in the works. When I asked someone about this, they said "You need to use the Microsoft Provider" and gave a lecture on how Microsoft release all these things for free and how good they are and should be re used as much as possible. I have done quite a bit of research on it (mainly looking at the videos on http://asp.net/learn ) and am very impressed by

How to create custom WebSecurity.Login and WebSecurity.CreateUserAndAccount methods in MVC 4?

允我心安 提交于 2019-11-30 05:16:50
When we choose New Project --> MVC 4 --> Internet Application , it will automatically generate AccountController for us. In this controller, I only care about 2 actions, Login and Register . In MVC 3, it uses Membership's static methods, ValidateUser in Login action and CreateUser in Register . So, if I want to integrate it with my own database, I just need create CustomMembershipProvider by extending MembershipProvider and override that two methods. But in MVC 4, it uses WebSecurity.Login and WebSecurity.CreateUserAndAccount . My questions are: How can I make it use my own database like I did

How to configure Ninject for MVC4 & custom Membership provide?

人盡茶涼 提交于 2019-11-29 12:14:42
According to this article description custom-membership-provider-with-repository-injection I implement the custom Membership provide with inject. Custom Membership provider using Ninject; public class CustomMembershipProvider : MembershipProvider { [Inject] public IUserRepository UserRepository { get; set; } [...] Custom Role Provider using Ninject; public class CustomRoleProvider : RoleProvider { [Inject] public IUserRoleRepository UserRoleRepository { get; set; } [...] within Web.Config <membership defaultProvider="CustomsMembershipProvider"> <providers> <clear/> <add name=

How to create custom WebSecurity.Login and WebSecurity.CreateUserAndAccount methods in MVC 4?

不想你离开。 提交于 2019-11-29 03:30:56
问题 When we choose New Project --> MVC 4 --> Internet Application , it will automatically generate AccountController for us. In this controller, I only care about 2 actions, Login and Register . In MVC 3, it uses Membership's static methods, ValidateUser in Login action and CreateUser in Register . So, if I want to integrate it with my own database, I just need create CustomMembershipProvider by extending MembershipProvider and override that two methods. But in MVC 4, it uses WebSecurity.Login

How to configure Ninject for MVC4 & custom Membership provide?

那年仲夏 提交于 2019-11-28 05:57:00
问题 According to this article description custom-membership-provider-with-repository-injection I implement the custom Membership provide with inject. Custom Membership provider using Ninject; public class CustomMembershipProvider : MembershipProvider { [Inject] public IUserRepository UserRepository { get; set; } [...] Custom Role Provider using Ninject; public class CustomRoleProvider : RoleProvider { [Inject] public IUserRoleRepository UserRoleRepository { get; set; } [...] within Web.Config

HttpContext.Current.User.Identity.Name is always string.Empty

百般思念 提交于 2019-11-27 07:16:39
Hi I use a custom MembershipProvider. I want to know the current username during an application scenario, but when I try accessing HttpContext.Current.User.Identity.Name it always returns string.Empty. if (Membership.ValidateUser(tbUsername.Text, tbPassword.Text)) { FormsAuthentication.SetAuthCookie(tbUsername.Text, true); bool x = User.Identity.IsAuthenticated; //true string y = User.Identity.Name; //"" FormsAuthentication.RedirectFromLoginPage(tbUsername.Text, cbRememberMe.Checked); } Am I missing something? FormsAuthentication.SetAuthCookie(tbUsername.Text, true); bool x = User.Identity

HttpContext.Current.User.Identity.Name is always string.Empty

牧云@^-^@ 提交于 2019-11-26 13:09:12
问题 Hi I use a custom MembershipProvider. I want to know the current username during an application scenario, but when I try accessing HttpContext.Current.User.Identity.Name it always returns string.Empty. if (Membership.ValidateUser(tbUsername.Text, tbPassword.Text)) { FormsAuthentication.SetAuthCookie(tbUsername.Text, true); bool x = User.Identity.IsAuthenticated; //true string y = User.Identity.Name; //\"\" FormsAuthentication.RedirectFromLoginPage(tbUsername.Text, cbRememberMe.Checked); } Am