roleprovider

Does the asp.net RoleManager really cache the roles for a user in a cookie if so configured?

。_饼干妹妹 提交于 2019-12-04 13:58:24
In my web.config I have the Role Manager configured as follows: <roleManager enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All"> however in our custom RoleProvider it would seems that the GetRolesForUser method is always being called, rather than as I would have expected, the RoleManager serving up the roles from its cookie. We're using something like to get the roles for a user: string[] myroles = Role.GetRolesForUser("myuser"); Is there something that I'm missing in

Symfony2 in_memory users provider issue

旧巷老猫 提交于 2019-12-04 07:32:12
I have a Symfony2 application that loads users from in_memory user provider. The security.yml is the following: security: encoders: Symfony\Component\Security\Core\User\User: plaintext role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] providers: in_memory: users: admin: { password: mypassword, roles: [ 'ROLE_ADMIN' ] } firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false login: pattern: ^/demo/secured/login$ security: false secured_area: pattern: ^/ anonymous: ~ http_basic: realm: "MyApp Realm - Login" access_control:

Why would this catch all block not in fact catch all

二次信任 提交于 2019-12-04 05:06:34
The code is fairly simple --- the issue is that there is an invalid character in the groupPath string (a '/' to be exact). What I'm trying to do (at least as a stop gap) is skip over DirectoryEntries that I can't get the cn for --- regardless of why. However when I run this code the catch block doesn't run and I get instead: The server is not operational. and an unhandled System.Runtime.InteropServices.COMException. Why would the catch block not catch this exception. try { using (DirectoryEntry groupBinding = new DirectoryEntry("LDAP://" + groupPath)) { using (DirectorySearcher groupSearch =

attribute for .net MVC controller action method

瘦欲@ 提交于 2019-12-04 03:50:10
Essentially I want to show a friendly message when someone is not part of a role listed in my attribute. Currently my application just spits the user back to the log in screen. I've read a few posts that talk about creating a custom attribute that just extends [AuthorizeAttribute], but I'm thinking there's got to be something out of the box to do this? can someone please point me in the right direction of where I need to look to not have it send the user to the log in form, but rather just shoot them a "not authorized" message? If simplicity or total control of the logic is what you want you

Default Role Provider could not be found on IIS 7 running .NET 4

一笑奈何 提交于 2019-12-03 16:18:06
Good morning all, I am attempting to implement my custom membership and role providers in my web application that I have implemented under the Default Web Site in my instance of IIS 7. My web application is running under a .NET 4 application pool. However, after setting up the corresponding web.config, I get the following error: Parser Error Message: Default Role Provider could not be found. I have included the following block of code in the system.web section of the corresponding web application's web.config: <membership defaultProvider="CustomMembershipProvider" userIsOnlineTimeWindow="20">

Using Ninject with a Custom Role provider in an MVC3 app

纵然是瞬间 提交于 2019-12-03 09:43:08
问题 I'm trying to use a custom role provider in an MVC3 app. I've already got the membership provider working ok using Ninject but can't seem to get the role provider working. The Membership provider doesn't require a parameterless constructor but role provider does. Here's some code snippets: Web.config <membership> <providers> <clear/> <add name="MyMembershipProvider" type="MyApp.Models.NHibernateMembershipProvider" applicationName="myApp" /> </providers> </membership> <roleManager enabled=

How to handle errors in my CustomAutorize attribute in asp.net 3.0 Application

强颜欢笑 提交于 2019-12-02 05:18:52
I am working on an asp.net MVC 3.0 Application. I am using using my own CustomRoleProvider and CustomErrorHandler by overriding default attributes. Every thing is working fine. But ,the problem is with the exception handling. While testing the application , tester has given invalid DB connection to test. The result is , Custom Error Handler is not rendering Error View , instead it is routing the original path For ex: I am running my application as Home/Index It is first hitting Custom Role Provider to fetch the roles for the application Since , the Db Connection is not correct , it is raising

What would be equivalent web.config configuration for “enableSimpleMembership”="true:

拥有回忆 提交于 2019-12-01 06:25:19
问题 What would be equivalent configuration of Membership and Role providers in Web.Config for: <appSettings> <add key="enableSimpleMembership" value="true" /> </appSettings> in ASP.NET MVC 4? 回答1: Equivalent configuration of web.config would be: <appSettings> <add key="enableSimpleMembership" value="false" /><!-- false is default if key is not present --> </appSettings> <connectionStrings> <add name="DefaultConnection" connectionString="..." providerName="System.Data.SqlClient" /> <

ASP.NET MVC 3 Ninject Custom Membership and Role Provider

余生长醉 提交于 2019-11-30 20:33:09
Hi i got some problems enabling custom Membership and Role Provider, i got following error: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. System.InvalidOperationException: Default Membership Provider could not be found. It's pointing to my mvc3.ninject kernel.Inject(Membership.Provider) My MVC3.Ninject in app_start: private static void RegisterServices(IKernel kernel) { kernel.Inject(Membership.Provider); kernel.Inject(Roles.Provider); kernel.Bind

Remove asp.net membership and roles provider

耗尽温柔 提交于 2019-11-30 16:58:19
For whatever reason, the site I was working on (after a bit of pause) begun screaming about an sql server connection for the asp.net membership. I'm using mysql without asp.net membership so it was weird. However just to be sure I've decided to remove anything related to it, including role providers. I've added these to the web.config <membership> <providers> <clear /> </providers> </membership> <roleManager enabled="false"> <providers> <clear /> </providers> </roleManager> <profile enabled="false"> <providers> <clear /> </providers> </profile> However, it still throws exception: