.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Adding user to certain roles

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net

I have setup ASP security in my application. I used the following tutorial, just wondering if someone can tell me how i can setup this up to allow the creation of a user?


Can someone tell me where to find or what to search on to find some example of how to add the option for adding users?

I have the above setup and its working, but only because of the accounts i created with my global.asax file.
I need to give the admins access to add a new user. Currently i can search on existing users and update them, but need to add the ability to add a new user.

View Complete Post

More Related Resource Links

Advanced Basics: Adding New Features with User Controls


In past versions of Visual Basic, there were rudimentary graphics controls. In Visual Basic .NET you have the GDI+ library, which enables you to draw lines, circles, and most anything else. But how can you use the functionality of GDI+ to create lines and other graphics that respond to user mouse clicks and events? Find out.

Ken Spencer

MSDN Magazine June 2003

Checking SQL Server User Roles and Creating SQL Server Users using VB.NET

Hello gurus!Firstly I want to apologies if this question is out of place here.. if someone can direct me to the correct forumn great and Thanks!I have a VB.NET application which uses its own Backend Database (MSSQL Server). I need to distribute this application to sites where there will be an existing SQL Server.So I will need to Create the Database on this server. The Application includes methods for building the database on startup if not already connected to one.However the users windows logon may not have the correct permission to connect and create a Database on the Server. I have a DB Setup form in my application which asks for the Servname, Username, Password and Database name. I have catered for Windows Authentication and SQL Server Authentication within the form - the user makes the choice.Assuming they enter a Username and Password for SQL Server Athentication then I will be trying to connect using this user and create the database on the given server. The following is my outline logic:-                                                                  Create db Process                                                                             |                                                                             |                                                               Check Credentials                                                                   / 

adding user account from background

i have almost 2500 peoples details i want enter it to the database from background using one exel sheet .but when i enter all the details i want to set  the password for each user in the database (must be unique)

Dynamically adding User Controls -- newbie question!

I am new to ASP.NET (coming from ColdFusion, thank goodness I'm away from that!).  And I am have THE hardest time understanding how to work with forms in ASP.NET.  Here's what I am doing:Dynamically add User Controls to a PlaceHolder based on some int value (which currently is passed in a HiddenField).Fire an event if the WebControls inside of the User Control change, then handle that event in the Main Page (i.e. save the input to DB)When the user clicks the "Next/Continue" button, the next controls for the next page are loaded.And I guess maybe I just can't seem to get how things work in ASP.NET, because I am really struggling with the general idea of how ASP.NET flows.  Should I be dynamically loading the controls in Page_Init, or Page_Load?  Or should I load the controls when the buttonclick event is fired?Do I have to add the axCtrl.OnDataChange += new EventHandler(HandleAxControlDataChange); line on Page_Load?  Or should I put this in When I first load the UserControl, I need to initialize some WebControls within the UserContorl.  Is there a way to know if I have loaded new user controls into my placeholder?  I can't use Page.IsPostback, because after the first page, every page is a postback from the buttonclick.Any help for this confused newbie would be GREATLY appreciated!!Here's what I have: pu

Redirect to specific page based on user Roles

I am using Formsauthentication. My situation is as per below:the login form has codebehind :==============================protected void LoginButton_Click(object sender, EventArgs e)        {            TextBox uname = Login1.FindControl("UserName") as TextBox;            TextBox pass = Login1.FindControl("Password") as TextBox;            CheckBox rm = Login1.FindControl("RememberMe") as CheckBox;            Literal fail = Login1.FindControl("Literal1") as Literal;            if (Membership.ValidateUser(uname.Text, pass.Text))            {                /                FormsAuthentication.SetAuthCookie(uname.Text, rm.Checked);                            }        &

Adding user names when updating gridView

Hi All,May be this is a begineers question, could someone help on this please?I'm using a windwos authentication via intranet. I'm able to display the username in a label control on a page load event (which is very simple). I'm not storing this data anywhere in the table (MS SQL). I have all my data in a table and I'm using a gridview to diplay them. I'm using a button control to update all the rows in the gridview. I wanted to update three columns in the gridview (1. Tickbox, 2.Datetime Stamp and 3.UserId).I've created a query in the dataset, through which i can update the Tickbox and DateTime stamp using now() function. But I'm not sure how to update the UserID field with the UserName (which inturn updates all the three fields in the gridview when the button is pressed.

adding database user as a DBO

Hi there - I'm a SQL newbie I have a T-SQL script I've been working on. Currently it's in 2 parts and both parts work if I run then separately - my question is - can they be combined? Part 1: Creates a new DB CREATE   DATABASE LUCY_Config ON PRIMARY (   NAME = N'LUCY_Config', FILENAME = N'Q:\MSSQL\DATA\LUCY_Config.mdf' , SIZE = 1024MB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024MB ), FILEGROUP   FG1 DEFAULT ( NAME = N'LUCY_Config_Dat1', FILENAME = N'Q:\MSSQL\DATA\LUCY_Config_Dat1.ndf' , SIZE = 1024MB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024MB),   (NAME = N'LUCY_Config_Dat2', FILENAME = N'Q:\MSSQL\DATA\LUCY_Config_Dat2.ndf' , SIZE = 1024MB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024MB),   (NAME = N'LUCY_Config_Dat3', FILENAME = N'Q:\MSSQL\DATA\LUCY_Config_Dat3.ndf' , SIZE = 1024MB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024MB)   LOG ON (   NAME = N'LUCY_Config_Log', FILENAME = N'Q:\MSSQL\DATA\LUCY_Config.ldf' , SIZE = 250MB , MAXSIZE = UNLIMITED , FILEGROWTH = 1024MB ) Collate   Latin1_General_CI_AS_KS_WS Go ***************** Part 2 - adds a user as a DBO - use   [LUCY_Config]   IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'moss2\setup')   CREATE USER [moss2\setup] FOR LOGIN [moss2\setup];   EXEC sp_addrolemember N'db_owner', N'moss2\setup'

Adding CBA User into User Profile

user = upm.CreateUserProfile(sup.Name); thows the following exception. System.ComponentModel.Win32Exception: No mapping between account names and security IDs was done The CBA Account:  i:05.t|wingtipsts|user1@wingtip.com Is this the correct strAccountName to use. Or should the value used come from the ClaimTYpe: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier Thanks in advance

Admin page to manage users, need help with adding roles to this layout


Currently i have a page that has the following  code / layout.. as it is now, i am only displaying the roles and they cant be edited. Since this would be the admin page to manage users, what i would like is to have the Roles display as a checkbox list that shows all our roles and have the roles that the user is assigned to checked. Can that be done, if so are there any examples or tutorials i can review?


            <asp:GridView ID="GridView1" runat="server"  AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="UserName" DataSourceID="ObjectDataSource1" AllowSorting="True" Width="80%">
                    <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
                    <asp:CheckBoxField DataField="IsOnline" HeaderText="IsOnline" ReadOnly="True" SortExpression="IsOnline" />
                    <asp:CheckBoxField DataField="IsLockedOut" HeaderText="IsLockedOut" ReadOnly="True" SortExpression="IsLockedOut" />
                    <asp:BoundField DataField="UserName" HeaderText="UserName" ReadOnly=&quo

Use of aspnetdb configuration for user login,roles and all



I created a web application and i created the users,roles and all using the asp.net configuration,

the aspnetdb is created and i include that in my project adn run it it works fine.

then i copy the whole folder in my root folder of my IIS and it works perfectly fine

Now if i want to create the whole project into an exe such that  if i run the exe on a system that has iis on it,it should automatically create the virtual directory and i shud be able to run it from the new server.

i tried it but the login is not working,

Can you help me finding out the exact way in which i can create the login features using the asp.net configuration.

adding windows user control in asp.net application


hi fri i had created one user control in c# and i want to add this user control in asp.net application pl tel me how to do this

thanks in advance

Adding existing user to existing group - Unknown error (0x80005000)


I am getting an unknown error 0x80005000.  Please help!

I am using impersonation of an admin account. Here's what I have in my web.config:

<identity impersonate="true" userName="mydomain\user" password="pwd"/>

<authentication mode="Windows" />


Here's my code:

Private Sub Page_Load(ByVal sender As System.Object, <

Check User Roles (more than 50)


I have more than 100 roles defined for my app. Now I have a page which is allowed for around 50 roles,
so when user comes to page instead of writing too many if else conditions, what is the best & efficient way
to check the if user in any of those 50 roles?


I have more than 100 roles defi

Error adding connection filter for user profile sync


Trying to setup a connection filter for the user profile sync. I don't want to include any users in the sync with ExtensionAttribute12 = Exclude. When I click OK to confirm the filter, I receive the following error page:

An unexpected error has occurred.
C orrelation ID: 834e3e93-0b47-4d6b-a1f9-3bbc1c6a52df
Date and Time: 10/1/2010 1:32:33 PM

I have searched the logs for the correlation ID. I found the following error messages in the logs.

Failed to find the XML file at location '14\Template\Features\ExcelServerEditStapler\feature.xml'    c39758da-0b2b-4b84-969d-c24625b15963
Feature definition missing for Feature 'ExcelServerEditStapler' (Id: '

Adding back deleted User Profile Property


I've made a bit of an error. My SharePoint User Synchroniztion was all setup and working with My Sites and My Profile but the address was being duplicated. I removed one of the user profile properties under the contact collection. Now SharePoint can't render the My Profile pages. With logging turned up I get the following:

Unhandled exception caught during execution of Microsoft.SharePoint.Portal.PageBase::ErrorHandler()

Watson bucket parameters: SharePoint Server 2010, ULSException14, 06d8f9f3 "sharepoint portal server", 0e00129b "14.0.4763.0", b2be5063 "microsoft.office.server.userprofiles", 0e001294 "14.0.4756.0", 4b9b2905 "sat mar 13 05:56:21 2010", 0000082d "0000082d", 00000049 "00000049", 10bc7a81 "propertynotdefinedexception", 37706d61 "7pma"

Microsoft.Office.Server.UserProfiles.PropertyNotDefinedException: Property Not Defined: SPS-Location.  An administrator must create this property in the Profile Administration tool.    at

Problem is if I try to recreate a User Property with the name SPS-Location it won't let me so how do I get this back?



Deactivating a user roles automatically when email activation is clicked


 Hi I know this is a simple fix but here's my register.aspx.vb and activation.aspx.vb codes. Its given an ordinary user unauthorized permissions after activation from email link which when clicked, approves and logs them in.


Protected Sub RegisterUser_CreatedUser(ByVal sender As Object, ByVal e As EventArgs) Handles RegisterUser.CreatedUser


    If _group IsNot Nothing Then

      Dim mp As ******WebMembershipProvider = CType(Membership.Provider, ******WebMembershipProvider)

      Dim user As MembershipUser = Membership.GetUser(RegisterUser.UserName)

      mp.AssociateUserWithGroup(user, _group)


      Dim cuw As CreateUserWizard = DirectCast(sender, CreateUserWizard)

      Dim userId As Guid = DirectCast(user.ProviderUserKey, Guid)

      Dim EmailMsg As New System.Net.Mail.MailMessage("inquiry@*******.com", RegisterUser.Email)

      EmailMsg.Subject = "Email Verification from ******.com"

      EmailMsg.IsBodyHtml = True

      EmailMsg.Body = "T

Adding Current Windows User to Database Encounters Existing User with Same Login


In VS2008 in debug mode, I am using SMO to programatically change the users and permissions on a database. Windows authentication alone is being used. I need to limit access to a administrators group and the current user for whom the database has been dynamically created during the first run of the application within their current Windows environment on the machine. I have no problems creating and assigning the administrators group, but when I try to create the user using the environment's UserDomainName and UserName variables (which would be my creditals) I encounter an inner exception "The login already has an account under a different user name". Before doing running the app, I manually have checked the local server for user and logins with my credentials and programatically looked at each login but have not found any matching credentials. 

Insights and suggestions appreciated.


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend