roleprovider

RoleProvider dosn't work with custom IIdentity and IPrincipal on server

两盒软妹~` 提交于 2019-11-28 04:35:33
问题 I'm using a custom IIdentity and IPrincipal in my ASP.NET MVC application via EF 4.3 as expalined here (and follow accepted answer's solution). Also, I have a custom RoleProvider . In local (using IIS Express ), it works currectly . But now, when I upload the application on a real host, it seems all users are in "admin" role! e.g. I create a user that is not in role "admin" , but it can access to all protected pages (that need "admin" role). e.g. Role.IsUserInRole always returns true . Have

ASP.NET Multi tenant application with tenant specific roles

余生长醉 提交于 2019-11-27 23:03:46
问题 We have a multi-tenant ASP.NET application. So far tenants have been isolated from each other, however now we have Agencies that manage multiple tenants and want to be able to manage all their tenants with a single user account. I'm trying to figure out the best way to accomplish that, hopefully without much change to the existing technologies that we are using. Relevant technical details: AspNetSqlMembershipProvider for both membership and roles C# 4.0 (soon to be 4.5) Forms Authentication

Poor Performance with WindowsTokenRoleProvider

我的未来我决定 提交于 2019-11-27 16:25:21
问题 I'm using WindowsTokenRoleProvide r to determine Active Directory group membership in an ASP.NET web application. My problem is that performance is not good, especially when a user is in many groups. As an example, I am in 253(!) groups, and WindowsTokenRoleProvider is taking around 150 seconds to determine what groups I am in. I know I can use caching so that this isn't done on subsequent requests for a user, but obviously it isn't acceptable to take that long on the first hit. What are my

is there an authorizeattribute equivalent to just standard web forms (not MVC) for .net

放肆的年华 提交于 2019-11-27 16:07:43
I'm working on a project that will use windows role providers and I want to limit functionality to certain AD groups. With MVC, I could use an AuthorizeAttribute above my action methods and redirect accordingly. Is there something similar I can do for a standard web forms application (.NET 3.5) that doesn't use MVC? You can set this up in web.config with the authorization element. <configuration> <system.web> <authorization> <allow roles="domainname\Managers" /> <deny users="*" /> </authorization> </system.web> </configuration> Basically domain groups are translated into roles when using

MVC4: UserIsInRole - Unable to connect to SQL Server database

这一生的挚爱 提交于 2019-11-27 11:59:06
问题 Breaking my head around with this, yesterday it worked fine and today it seems to be broken: This line is generating the error: @if (Roles.IsUserInRole(HttpContext.Current.User.Identity.Name, "Admin")) the error is: Unable to connect to SQL Server database. Whole exception: System.Web.HttpException was unhandled by user code HResult=-2147467259 Message=Unable to connect to SQL Server database. Source=System.Web ErrorCode=-2147467259 WebEventCode=0 StackTrace: at System.Web.DataAccess

ASP .NET Custom RoleProvider not respecting cacheRolesInCookie=“true”

人走茶凉 提交于 2019-11-27 09:31:35
I've implemented a custom role provider, and configured it in my web.config file like this: <roleManager enabled="true" defaultProvider="TDRoleProvider" cacheRolesInCookie="true"> <providers> <clear/> <add name="TDRoleProvider" type="TDRoleProvider"/> </providers> </roleManager> I've overridden the GetRolesForUser function in my custom role provider, and I've stepped into it, and it works just fine - loads up 60 roles for the user I'm testing with. However, I've noticed that the GetRolesForUser gets called on every request that calls User.IsInRole. In other apps I've written, it only calls it

Refresh current user's role when changed in ASP.NET identity framework?

非 Y 不嫁゛ 提交于 2019-11-27 05:09:14
Using VS 2013, standard MVC template, and the Identity provider framework The user is logged in, and I have: //.... UserManager.AddToRole(User.Identity.GetUserId(), "Members"); # Line X RedirectToAction("Index", "Members"); And the Members controller is as follows: [Authorize(Roles="Members")] public class MembersController : Controller { // GET: Members public ActionResult Index() { return View(); } } After Line X is executed, I can confirm that the user is added to the table dbo.AspNetUserRoles . However, the user upon reaching the Members controller fails the role check. User.IsInRole(

Specifying Roles in web.config of an asp.net MVC application

孤街浪徒 提交于 2019-11-27 01:20:38
问题 I am creating an MVC application with forms auth. I am authenticating against active directory and so have created a custom RoleProvider. My application is only concerned with a small set of roles which up until now I have been defining in the appSettings section of my web.config: <appSettings> <add key="DirectorRole" value="Domain\Directors" /> <add key="ManagementRole" value="Domain\Managers" /> ... </appSettings> However I have run into a couple of problems with this approach: I cannot

The Role Manager feature has not been enabled

爷,独闯天下 提交于 2019-11-26 22:34:23
问题 Got the following ProviderException : The Role Manager feature has not been enabled. So far so good. Is there somewhere a method that can be called to check if the Role Manager has been enabled or not? 回答1: You can do this by reading from the boolean property at: System.Web.Security.Roles.Enabled This is a direct read from the enabled attribute of the roleManager element in the web.config : <configuration> <system.web> <roleManager enabled="true" /> </system.web> </configuration> Update: For

SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified

╄→尐↘猪︶ㄣ 提交于 2019-11-26 17:44:15
Well i have a big problem that i'm trying for days to solve but i could not do it, so i need your help. I have a web application in asp.net 4.0 where i implemented custom membership and role providers. When i open the app homepage in it connects to the database and retrieves some information. There is also a login form and when i login it validates the user through the database and redirects me to the reserved pages but than this error appears: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.