asp.net-roles

ASP.NET MVC Single Sign-on and Roles

空扰寡人 提交于 2019-12-03 05:18:13
问题 I have basic Single Sign-On working across 2 MVC sites (call them SiteA and SiteB) using something along the lines of the following method: http://forums.asp.net/p/1023838/2614630.aspx They are on sub-domains of the same domain and share hash\encryption keys etc in web.config. I've modified the cookie so it is accessible to all Sites on the same domain. All of this seems to be working ok. The sites are on separate servers without access to the same SQL database, so only SiteA actually holds

ASP.NET MVC Single Sign-on and Roles

我怕爱的太早我们不能终老 提交于 2019-12-02 19:43:06
I have basic Single Sign-On working across 2 MVC sites (call them SiteA and SiteB) using something along the lines of the following method: http://forums.asp.net/p/1023838/2614630.aspx They are on sub-domains of the same domain and share hash\encryption keys etc in web.config. I've modified the cookie so it is accessible to all Sites on the same domain. All of this seems to be working ok. The sites are on separate servers without access to the same SQL database, so only SiteA actually holds the user login details. SiteB has a membership database, but with empty users. This works fine for my

Hide link based on Role

╄→гoц情女王★ 提交于 2019-12-01 00:17:25
问题 Im new to asp.mvc. I'm trying to develop a portal to maintain employee data. In my system only "Manager" has the rigths to create employee. How do I enable the link when manager log in and disable when employee log in. Thanks My View @model IEnumerable<SealManagementPortal_3._0.Models.VOC_CUSTODIAN> @{ ViewBag.Title = "List of Custodians"; } <h2>Index</h2> <p> @Html.ActionLink("Create New", "Create") </p> <script type="text/javascript"> jQuery(document).ready(function () { jQuery("#list2")

ASP.NET Login Redirect Loop when user not in role

穿精又带淫゛_ 提交于 2019-11-30 19:26:56
I'm in a bit of a bind with implementing Roles in ASP.NET MVC 5. I am attempting to log in as a user that does not have a role required to access the area of the application I'm trying to reach. What I would expect in this scenario is, I'm redirected to the login page again, and will be until I enter a set of credentials that do have access or I navigate to another area of the application. What is actually happening is that the application appears to go into a login redirect loop, debugging through reveals that the Login action is being called multiple times. Here is the login action:

How to best handle permissions (not roles) in asp.net membership, specifically in ASP.NET MVC

和自甴很熟 提交于 2019-11-30 11:53:04
问题 There are plenty of questions (and information) on setting up asp.net membership, role providers and the like. Whether or not you should use the built in platform provided by microsoft, or role extend the base classes and role your own. I have decided to extend the default providers and implement my own membership and role providers. Now my question, is specifically around role authentication. Traditionally, you would create roles maybe like 'Manager, Administrator, Employee, Super User' or

ASP.NET Login Redirect Loop when user not in role

只谈情不闲聊 提交于 2019-11-30 03:28:13
问题 I'm in a bit of a bind with implementing Roles in ASP.NET MVC 5. I am attempting to log in as a user that does not have a role required to access the area of the application I'm trying to reach. What I would expect in this scenario is, I'm redirected to the login page again, and will be until I enter a set of credentials that do have access or I navigate to another area of the application. What is actually happening is that the application appears to go into a login redirect loop, debugging

How to best handle permissions (not roles) in asp.net membership, specifically in ASP.NET MVC

老子叫甜甜 提交于 2019-11-30 00:41:14
There are plenty of questions (and information) on setting up asp.net membership, role providers and the like. Whether or not you should use the built in platform provided by microsoft, or role extend the base classes and role your own. I have decided to extend the default providers and implement my own membership and role providers. Now my question, is specifically around role authentication. Traditionally, you would create roles maybe like 'Manager, Administrator, Employee, Super User' or whatever you have. But what would/should you do with respect to permissions which I consider to be a

ASP.NET MVC Roles and Security

若如初见. 提交于 2019-11-29 13:02:29
Assume like this is my SampleController action method public ActionResult AdminView() { return View() } If want this controller method to be called if the logged in user belongs to admin role, otherwise this method call should be blocked and the user should get an some custom unauthorized access error page. In my asp .net mvc web application, when the user logs in, I am storing the user role in a session as a string. And whenever there is a need to validate the user role, I compare the value stored in the session against a constant say "ADMIN_ROLE". But I am writing that piece of code to check

MVC 5 - Roles - IsUserInRole and Adding user to role

旧时模样 提交于 2019-11-29 02:34:05
In MVC4 i used Roles.IsUserInRole to check if a given user is in some role. However, with MVC5 i can't do it anymore... At first, it asked me to enable RoleManager at the web.config but then i discovered that microsoft moved away from Web.Security to Microsoft.AspNet.Identity. My question now is, with Microsoft.AspNet.Identity how do i do an action similar to Roles.IsUserInRole? And/or create a relation between the Role and the User. By the way, i'm still trying to understand the new authentication methods (ClaimsIdentity?). You should read http://typecastexception.com/post/2014/04/20/ASPNET

Adding Role dynamically in new VS 2013 Identity UserManager

醉酒当歌 提交于 2019-11-28 22:05:09
I created a new MVC application in the new VS2013 IDE. I added the following to the Login Action on the AccountController as I wanted to create a default user dynamically: var admin = new ApplicationUser() { UserName = "administrator" }; var result = UserManager.Create(admin, "administrator"); This works great, I then wanted to put this default user into a new default role: user = UserManager.FindByName("administrator"); var roleresult = UserManager.AddToRole(user.Id,"admin"); The second line errors because obviously it can't find the role "admin" as it doesn't exist yet, but I can't find a