asp.net-membership

How to limit the access to a Controller or a folder in MVC?

限于喜欢 提交于 2020-01-04 07:46:09
问题 I use Asp.Net MVC 3, C# together with ApplicationServices Membership (the standard way suing MS Sql 2008 db). My folder structure is CONTROLLERS -- PageAController.cs -- ADMIN -- PageBController.cs I have a Users some with Role "AdminRole", some with no rules associated (anonymouse). I would like DENY access to the specific Controller and show a LOGIN page for PageAController.cs and to all Controllers within folder ADMIN for User that HAVE NOT the "AdminRole" associated. What it the way to go

Hashed passwords and PasswordRecovery control

瘦欲@ 提交于 2020-01-02 07:25:16
问题 1) firstUser was created when membership module had requiresQuestionAndAnswer set to false, while secondUser was created when requiresQuestionAndAnswer was set to true. If we try to recover pwd via PasswordRecovery PR control and we set requiresQuestionAndAnswer to true, then PR doesn’t email password to firstUser, but it does to secondUser. If we set requiresQuestionAndAnswer to false, then PR does email pwd to secondUser (it skips the question/answer stage). But why doesn’t PR also email

Implementing Custom Membership Provider Membership User Issues

孤街醉人 提交于 2020-01-02 05:40:16
问题 I am trying to implement a custom membership provider and want to change the GetUser method. The problem is that GetUser returns MembershipUser and I want to return MyMembershipUser which has two additional properties FirstName and LastName. I can create a new method in my membership provider which returns MyMembershipUser but then I think it won't make any sense. How would I go about doing this? 回答1: That would defeat the purpose of the Membership classes. Do something like this if you need

How to know if the current path is a secure path or not, in ASP.NET

我的未来我决定 提交于 2020-01-01 13:07:25
问题 Consider that a request is sent to this path: http://domain/users/1534 This URL is in public security, so everyone can see it without being authenticated in the site (without being logged in). Now consider that another URL should be secure: http://domain/admin/update-user This URL should pass the authentication process. Now, In my code, somewhere I need to know if the current path is a secure path or not (please don't ask why, and also by secure path I don't mean SSL, I'm just talking about

How to know if the current path is a secure path or not, in ASP.NET

扶醉桌前 提交于 2020-01-01 13:01:26
问题 Consider that a request is sent to this path: http://domain/users/1534 This URL is in public security, so everyone can see it without being authenticated in the site (without being logged in). Now consider that another URL should be secure: http://domain/admin/update-user This URL should pass the authentication process. Now, In my code, somewhere I need to know if the current path is a secure path or not (please don't ask why, and also by secure path I don't mean SSL, I'm just talking about

Redirect to other page according their roles

两盒软妹~` 提交于 2020-01-01 11:54:09
问题 i need help from u guys here. So, on my system, there are 2 roles. Admin and users. I use login control to enable them to login to the system. How can i make these two roles redirect to different page? I am using membership and form authentication. I would appreciate if you could give some help to me. Thank you :) 回答1: Handle the Login controls "OnLoggedIn" event. In this event, determine the current users role. That can be done as follows ("LoginUser" below represents your login control):

How do you rename a Role using Membership in .NET?

女生的网名这么多〃 提交于 2020-01-01 09:45:09
问题 I'm using ASP.NET Membership and noticed there isn't a method in the Roles class to modify a role (its name for instance), only to create and delete them. Is it possible or it's not supported? EDIT: @CheGueVerra: Yes, nice workaround. Do you know (for extra credit :) ) why it's not possible? 回答1: There is no direct way to change a role name in the Membership provider. I would get the list of users that are in the role you want to rename, then remove them from the list, delete the role, create

MembershipProvider in .NET 4.0

自闭症网瘾萝莉.ら 提交于 2020-01-01 07:56:52
问题 How can I add the MembershipProvider class to my .NET 4.0 project in VS 2010 B2? I want to customize a MembershipProvider, but I cannot without adding this class. Please guide me through this process. 回答1: Interesting. However, build errors are your friend ;) Attempting to build a class library built as you describe, I get the following build error: The type name 'MembershipProvider' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0,

MembershipProvider in .NET 4.0

為{幸葍}努か 提交于 2020-01-01 07:56:30
问题 How can I add the MembershipProvider class to my .NET 4.0 project in VS 2010 B2? I want to customize a MembershipProvider, but I cannot without adding this class. Please guide me through this process. 回答1: Interesting. However, build errors are your friend ;) Attempting to build a class library built as you describe, I get the following build error: The type name 'MembershipProvider' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0,

ASP.NET Membership Provider with Confirmation email

大兔子大兔子 提交于 2020-01-01 07:42:03
问题 Is there any framework/library for using ASP.NET Membership Provider with confirmation email, something ready to be used ? Standard functionality used on almost all public web sites. 回答1: Found good example: 4Guys from Rolla : Examining ASP.NET 2.0's Membership, Roles, and Profile 来源: https://stackoverflow.com/questions/424154/asp-net-membership-provider-with-confirmation-email