MVC :: Add New Role "trial" When A New User Is Created
Dec 23, 2010I'm new with MVC. I would like the standard code a bit. When an new user is registrated, I would like to have that his useraccount get automaticly the role "trial".
View 2 RepliesI'm new with MVC. I would like the standard code a bit. When an new user is registrated, I would like to have that his useraccount get automaticly the role "trial".
View 2 RepliesI'm migrating an ASP .NET 2.0 WebSite to WebRole (ASP.NET 4.0 and VS2010). After created new web role, I moved all files and folders from website to WebRole then reference all needed dlls. I build and run web role stand alone and everything ok without problems. But when I build and run WindowsAzureProject, below errors come up
[fabric] Role state Stopping
[fabric] Role state Stopped
[fabric] Role state Aborted
[fabric] Role state Teardown
[fabric] Role state Destroyed
[runtime] Role entrypoint could not be created:
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.CreateRoleEntryPoint(RoleType roleTypeEnum)
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)
and the status "Operation was canceled" It takes me days to resolve but nothing found. I did set "Copy local" to true for all reference dlls but it doesn't effect also. I've just thought spring.core and spring.aop caused the error but I don't know how to debug and catching where it crash
I would like to use the asp.net membership and role management. However, all I found is fixed role control on the page level. Is there a way to let customer (administrator) to create their own roles, and assign the permission (edit, add, or view) to them, and then, use the permission to control te display (for example: edit button visible or not)?
View 5 RepliesI'm trying to allow logged user who are in department XYZ to perform some task for my third party App. I have two SQL tables named Users & UserList. The third party app (GoldMine) graps the USERNAME from the Users table and store it as UserID which I then referecnce SessionID. The UserList table has two columns (GM_UserName & Department) which I'm interested in. When a user login into the 3rd party app (GoldMine), i then compare the USERNAME (from Users table) to GM_UserName (from UserList table) and see whether GM_UserName is in = 'Dept XYZ'. Take a look at the SQL query below.
sqlDept = "SELECT USERNAME FROM Users LEFT JOIN UserList ON UserList.GM_UserName=Users.UserName WHERE UserList.Department ='Dept XYZ'"
I'm able to do this.
If Session("Userid") = "TestUser1" Or Session("UserID") = "TestUser2" Then Do this Else Do that End If
BUT unable to do this...
If user's Department = 'Department XYZ' Then
Do This
Else
Do that
End IF
I want to display a menu (which will be strongly typed with it's own unique model) across all pages only if a user is logged in.What menu items are available depend on the user's role and also I'll need to hit the repository to get numbers like "x Messages", etc
Been scratching my head for a simple solution here. Don't want to create something that need changes all over the place.All my controllers derive from a BaseController, all my Models from BaseViewModel....probably where I'll be implementing functionality for this.
I have LOGIN PANEL for student, and I want to disable it in different page. And only the admin can enable and disable it. I dont know the logic behind here.
View 1 RepliesI want to implement access control for usercontrols depending on user role(s), I want to do it on the control base class, in such way that on every user control I only need to set a string with allowed roles to see the user control
This is how an user control class may look like:
public partial class SimpleMenu : MyUsrControlBase
{
protected void Page_Load(object sender, EventArgs e)[code]...
How to set up user control visibility from the base class depending on the validation result?Also which event in the user control is the best to set the roles?
AlloweRoles = "RoleA, RoleB"
I am in the process of creating a user control that enables content areas of our web application to be editable. The control utilizes the asp.net membership/role providers and incorporates a LoginView that only displays the edit link if a user has logged in and is a member of the desired role. What I would like to be able to do is pass the "role" as a property of the control so it can be set dynamically and does not have to be hard coded into the control if I use elsewhere in another application.
View 3 RepliesThis is what I have in the RegisterUser.aspx and yet when the admin registers a new user, then on clickiing the register button, the site logs in as the user who was just created.
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
Roles.AddUserToRole((sender as CreateUserWizard).UserName, "Department");
}
I have the membership provider and the create user with tow steps, one of the steps contains a custom registration form, for each created user data will be in the database, and there is an account page shows the data that the new created user did insert during the registration process on the custom registration page,
the problem, when the user is created and logged into his account page, this account page shows only the information for the first created user, not the info on the logged in user , but the logged in user data still saved in database and not showing on his account page?
This is web.confg code:
<?xml version="1.0"?>
Our application lets the administrator create new users. Since the administrator is logged in, I have set Logincreateduser = false so that the administrator is not logged out even after creating the new user.
The problem is :I need the userid of the newly created user to store additional details of the user in another database table. I see that i can get the username using Createuserwizard1.username; but how do I get the userID?
Is there any way that I can find the exact name of the role a User is in? There is a property for UserName ( User.Identity.Name) but what about the role?
View 1 Repliestrying to get a login script working, its working fine, but now i have a new problem, i have a field im my DB thats called "urole" in that i have 3 roles, Admin, Co-Admin, User.
How can i use something like this on a page.
Code:
If Roles.IsUserInRole("Admin") Then
Label1.Text = User.Identity.Name + " is an Admin"
Else
Label1.Text = User.Identity.Name + " is NOT in an Admin"
End If
I have this script on my login page
Code:
Imports System.IO
Imports System.Data
Imports System.Data.OleDb
Imports System.Web.Configuration
Partial Class DbLogin
Inherits System.Web.UI.Page
[code]....
and then i have this on my default page, thats shows the info from an user, now i just want to show the role (urole) and then use an "If Roles.IsUserInRole" event so i can show some diffrent thing if admin, co-admin or User
Code:
Imports System.IO
Imports System.Web.Security
Partial Class _Default
Inherits System.Web.UI.Page
[code]....
(The aboved is working fine, but its not showing the urole/Role of an user)
In code, how can I change the user's role from one to another?
Let's say the user1 is in Role1. I would like to change his role to Role2.
I have a page setup to manage and create users.. in order to help the process of creation, i woudl like to add the new users to our default "users" role when they click the create button. Below is what is in place for the creation page and the button event tied to the button. I used this from a tutorial i found else where, but dont have the link at the moment if anyone needed it.. but the code below works great when creating a new user
[Code]....
I wish to know the way to add ASP.NET ("Machine_Name"IIS_IUSRS) to user role in COM+ component programmatically using C#. So whenever my COM+ component is being installed, ASP.NET user is created under Role.
View 1 Repliesis there a way i can get the role in a string variable using the below commands....
System.Security.Principal.WindowsIdentity wi = System.Security.Principal.WindowsIdentity.GetCurrent();
System.Security.Principal.WindowsPrincipal wp = new System.Security.Principal.WindowsPrincipal(wi);
i need this for
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, // version
UserName.Text, // user name
DateTime.Now, // creation
DateTime.Now.AddMinutes(60),// Expiration
false, // Persistent
role); // User data
as string role= wp.IsInRole();
but this is not right
The roles of users are not saved. Here is what i am doing:
[Code]....
And i added this to the create user wizard:
<asp:WizardStep ID="SpecifyRolesStep" runat="server" StepType="Step"
Title="Specify Roles" AllowReturn="False">
<asp:CheckBoxList ID="RoleList" runat="server">
</asp:CheckBoxList>
</asp:WizardStep>
I need to get the role of the user using memebership.
View 2 RepliesI roll my own SiteMapProvider inheriting System.Web.XmlSiteMapProvider.I want to override logic of checking user to be in a role specified in siteMapNode's property roles:
<siteMapNode url="Add.aspx?type=user" title="Add user" roles="admin" />
How can I do that? Which class's member does XmlSiteMapProvider call to check that if securityTrimmingEnabled="true"?
Setting role when creating new user with ASP.net MVC
I am looking at the default ASP.net MVC 2 controller.
How do I set the role for the new user that is created in the Register method?
Is this possible with just a simple property set or do I have to do something special?
There used to a lot of tutorials on the asp.net site and I can't find any of them anymore. Anyway, I'm looking for a tutorial on how to send out an email to the newly registered user for verficiation. After the user checks his/her email and click the link in the email, it automatically unlock the user's account and allow him/her to login to the site. Below is what I have so far:
[Code]....
[Code]....
And verification page_load:
[Code]....
The user does receive the verification email and when he/she click on the link it does come over to the verification.aspx page; however, the user still can't login. When I looked at the status of the user, it's still locked.
im using forms authentication and created roles.
while the user enters the credentials im authenticating the user with username and password
now i also want to check the particular user whether he is that role.
eg:
if username,password are true and role is Admin i redirect him to Adminhome.aspx
else to empHome.aspx.
im able to chek username and password but im unable to detect the role.
[Code]....
How can i give access to IIS_WPG user role in IIS.
I am trying to run .net 2.0 application on windows xp laptop
I have a login form from the membership and I am trying to make it so that it would redirect depending on role. I have tried to put this code under login1_loggedin but it didn't seem to work. how can I do this?
View 1 Replies