User Login and Roles

I am just starting to work with Web Forms and am looking for a way to have user authentication only when a user choses to login, and to have user roles give them access to post, edit, delete, or a combination of those. I have the Wrox book - Beginning ASP.Net with VB.Net and it doesn't go into enough detail on this subject.

If it is simple enough for someone to zip a project/solution file I would appreciate it...

If not please recommend some good books/sources of information.

Posted On: Monday 26th of November 2012 12:46:42 AM Total Views:  293
View Complete with Replies

Related Messages:

allow one user to login to the web page   (339 Views)
hi everybody,i just want to ask you that, how can i code to make sure only 1 user's account will be login at 1 times. this means that how to avoid 2 or more people use the same user account to login at the same time...your help will be appreciate.:thumb:
How would an ASP .NET web application handle constant user requests?   (209 Views)
I want to make a text based MMORPG in C# and ASP .NET. The game will involve constant, continuous updates for example the character/skill experience a player has. My question is, how would I store/update those skill experience variables Would I update the SQL Server database every single time a change is made to the "experience points" variables or would I only update the database at certain time intervals What state management would be best to store such data that is continously updating and is private to each user How might the requirements/techniques need to be changed if the website/web application becomes extremely popular with heavy traffic
usercontrol within IE   (399 Views)
hi !this is my problem:i wrote a winform usercontrol and when i put in in a web page it works well.well, it works well when my project just creted one DLL, but when my control uses multiples Dll, it doesn't work.this is the object tags of my web page: - this works because there is only one DLL < o b j e c t i d = " s i m p l e C o n t r o l 1 " c l a s s i d = " h t t p : W i n d o w s C o n t r o l L i b r a r y 1 . d l l # U s e r C o n t r o l 1 " h e i g h t = " 3 0 0 " w i d t h = " 3 0 0 " > < / o b j e c t > but if i have more than one Dll do build my usercontrol, i don't know how to specify it
problem usercontrol   (260 Views)
bonsoir , Voila mon projet consiste a faire un site de partage professionnel et donc j'ai une page profil qui contient des actualit,des document... Pour les actualit j'utilise un controle utilisateur qui contient un bouton(pour ajouter un commentaire) et un textbox( pour afficher l'actualit) et une photo , et je fait appelle a lui dynamaiquement dans une panel qui se situe dans ma page profil.aspx . Mon probleme c'est que quand je lance mon site le bouton est inactif je ne peux pas clicker dessus et quand j'ajoute un Hyperlink juste pour tester .. meme chose il est inactif . SVP j'ai besoin d'aide Merci.
Dynamically registering user controls with web pages   (194 Views)
I am implementing a system similar to the php nuke blocks system in which i simply place new .ascx user controls in the the relevent directory. I am looking for a way that the script can search the directory and find all the the user controls and add this to a drop down list.I know normally you would register the controls usering the:Code:Directive. Since you need to register the controls before being able to implement them in the web forms, i need to know how to register them dynamically so that i do not have to change my code ever time.Alos what HTML code would I use to include dynamically included user control
failed authentification login user   (180 Views)
hi, I have a script for the login user. Using a web service method. But this program can not execute service. Is it wrong if else statement ASP.NET [code]#region StatusUser [WebMethod] public string checkStatusUser(string uname, string pass,string status) { WMS.Handler.FilterStatusUser tu = new WMS.Handler.FilterStatusUser(); tu.FilterUsername = uname; tu.FilterPassword = pass; tu.FilterStatus = status; WMS.Handler.StatusUserData us = WMS.Handler.StatusUserHandler.GetStatusUser(tu); if (us.Password == pass && us.Username == uname && us.Status==status) { isStatusUser = "yes"; return isStatusUser; } else { isStatusUser = "no"; return isStatusUser; }} C# private void button1_Click(object sender, EventArgs e) { var user = textBox1.Text; var pass = textBox2.Text; var status = comboBox1.Text; WMSDService cf = new WMSDService(); var hasil = cf.checkStatusUser(user, pass, status); if ((hasil == user) && (hasil == pass) && (hasil == status)) { Form2 st = new Form2(); st.Show(); } else { MessageBox.Show("error"); } }
sending mail with attachment file to multiple user in with C#   (190 Views)
I want send mail which i have multiple register users after that i want send mail to all register users.all user name fetch from database but not successfully send mail with attachment file. when i am sending mail to multiple users with attachment file then occur a error. Multiple user names are fetching from my sql database. so Plz help me. My code is above ////////////////////////////// using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Net; using System.Net.Mail; public partial class CookeryAdmin_sendNews_RegUser : System.Web.UI.Page { DataService ds = new DataService(); string Uname; protected void Page_Load(object sender, EventArgs e) { if (Session["Login"] == null) { Response.Redirect("../Default.aspx"); } else { string strLogin = "select * from User_Details where email = '" + Session["Login"].ToString() + "' and isAdmin = 1"; SqlDataReader sdrLogin = ds.data_Select(strLogin); while (sdrLogin.Read()) { Uname = sdrLogin.GetString(sdrLogin.GetOrdinal("fName")) + " " + sdrLogin.GetString(sdrLogin.GetOrdinal("lName")); } lblMsg.Text = "Welcome, " + Uname; sdrLogin.Close(); } if (!Page.IsPostBack) { } } protected void btnSendNews_Click(object sender, EventArgs e) { try { fetchEmailId(); } catch (Exception ex) { TD1.InnerHtml = ""; TD1.InnerHtml = "ERROR: " + ex.Message.ToString(); } } private void fetchEmailId() { string strUser = ""; string sqlEmail = "select * from user_Details where isAdmin = 0"; DataTable dtEmailId = ds.data_SelectByAdap(sqlEmail); int count = dtEmailId.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { strUser += dtEmailId.Rows[i]["email"].ToString() + ","; } SendNewsletter(strUser); TD1.InnerHtml = ""; TD1.InnerHtml = "Newsletter successfully sent to Registered Users"; text_clear(); } else { TD1.InnerHtml = ""; TD1.InnerHtml = "No Registered user are available"; } } private void text_clear() { txtSubject.Text = ""; txtBody.Text = ""; } private void SendNewsletter(string emailId) { System.Web.Mail.MailMessage message = new System.Web.Mail.MailMessage(); message.To = emailId; message.From = ""; message.Subject = txtSubject.Text.ToString(); message.BodyFormat = System.Web.Mail.MailFormat.Text; message.Body = txtBody.Text.ToString(); if (msgUpload.HasFile) { string strFileName = msgUpload.FileName; msgUpload.PostedFile.SaveAs(Server.MapPath(strFileName)); System.Web.Mail.MailAttachment attach = new System.Web.Mail.MailAttachment(Server.MapPath(strFileName)); message.Attachments.Add(attach); } System.Web.Mail.SmtpMail.Send(message); Response.Flush(); } } //////////////////////////////////
how to paste our own created user contorl on a web form   (382 Views)
hii have created ascx. user control but dont know from where can i bring it on my web form.:)
WebForms user navigation   (189 Views)
Unfortunately, I got used to dealing with FrontPage and the "link bar" navigation scheme (webbots that implement DHTML). I know how to do web menus, user controls and there are 3rd party tools available for ASP.NET, but is it possible to keep track of page heirarchies and have them automatically reclaculate when pages/links move in ASP.NET Seems like a lot of work to hand code menus....
Extract value from query result, assign to user w Roles.AddUserToRole?   (247 Views)
I'm stuck on what might be some simple ASP.NET syntax: I have a page that allows a user to enter a code into a textbox, and then checks that code against a database table to return the values of one specific table row (if the code was correct) or an error message (if the code doesn't exist in the database table). The page functions without a problem, and I can display the results of the one returned table row in a DetailsView control. What I want to do, is to display some of the returned data in a Label or Literal control, and also to assign one of the returned string values ("Role") as the logged-in users new role, using Roles.AddUserToRole. So, for example, if the user enters the valid code 12Ab34Cd, the query will return the values: EnrollmentCode:12Ab34Cd Role:student ...I want to assign the string "student" as the user's new membership role, but I'm not sure how to do this. I'm using the standard ASP.NET membership provider, and all of the "Role" strings returned by the query are preexisting, valid membership roles that I have already created.
Login failed for user 'sa'   (145 Views)
Textbox not capturing username   (188 Views)
Hi.. does anyone know how to get loginname control value in textbox I am using loginname control after login,where it will display the username of the user. Now i want to get that username value to textbox. How do i suppose to do that
Let user remove row from datagrid   (232 Views)
I have an invoice for a client that populates several datagrids and then sum's values in the datagrid to calculate allocations. Problem is I'd like to add a control that allows the user to remove a row from the datagrid ... is there a easy way to go about this or do I need to completely repopulate the grid any suggestions
How to reset and get password of membership user in   (532 Views)
I am working on membership concepts in Now i want to reset new password and getpassword for specific user. this is my web.config code: How can I get old password and reset new password.
Where data is stored when createuserwizard is clicked in   (257 Views)
I used in-built template, that is createuser wizard. In that, I am creating new user and after that I logged in using that newly created username and password.. No prob it works fine. But I want to know where the data is stored. I have searched in my sql db.. but there is no database was newly created. Can anyone tell me.
Unique users   (149 Views)
I am thinking of making sort of a learning portal where you pay for an account by yearly basis but was thinking on how that can be abused. How can I restrict only one user to use the features and not share his/her login. The only feature that I could think of is not allowing 2 simultanious logins but since I was not thinking of having features where you have to be live I do not really know what to do. Ideas
storing user input into a database (C# + SQL)   (225 Views)
, I've just started creating an online Blackjack application. I'm currently at a stage where the user can press a button called " twist " and then a random number between 1 and 11 is generated. I'd like to know how I could store the results from this into a database ( I have and empty one column table called " cards " ). Here is my code Blackjack private int RandomNumber(int max) { Random random = new Random(); return random.Next(max); } void twist(object sender, System.EventArgs e) { int a = 11; int c = RandomNumber(a); Result.Text = (c).ToString(); } How can I dynamically store "Result" into an SQL database
!Urgent Cannot modify user account in Active Directory via   (143 Views)
My System Have 2 Computer: Frist Computer act as A domain Controller that has a Active Directory,RADIUS Server,DHCP and DNS Second Computer act as A Web Server(join domain with a first computer already) and use Microsoft Visual Studio Team System 2008 I create a website on a second computer to add user in active directory. I have 3 file: 1.Default.aspx - Let user fill their privacy information 2.ViewRegisterdata.aspx - Let user confirm their information before it's added to active directory. In this file,there is a Viewregisterdata.aspx.cs which collect user information and send to Class1.cs when users click confirm button. 3.Class1.cs - Do the process in adding user in active directory I have a problem with a third files. When I run the website and go to a second page that is a ViewRegisterdata.aspx and then press a confirm button,it shows an error. This is my code in a third file: using System; using System.Collections; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.DirectoryServices; namespace senior { public class Class1 { public struct UserInfo { public string username; public string AccountName; public string firstname; public string lastname; public string address; public string email; public string displayname; public string password; public string givenName; } UserInfo newUserInfo; public Class1(string Rfirstname, string Rlastname, string Raddress, string Remail, string Rdisplayname, string Rusername, string RaccountName) { newUserInfo.firstname = Rfirstname; newUserInfo.lastname = Rlastname; newUserInfo.address = Raddress; = Remail; newUserInfo.displayname = Rdisplayname; newUserInfo.username = Rusername; newUserInfo.AccountName = RaccountName; DirectoryEntry adUserFolder = new DirectoryEntry("LDAP://;DC=seniorproject,DC=COM","","********"); if (adUserFolder.SchemaEntry.Name == "container") { DirectoryEntry newUser = adUserFolder.Children.Add("CN=" + newUserInfo.username, "User"); if (DirectoryEntry.Exists(newUser.Path)) { Console.Write("The user:" + newUser.Username + "exists, they will be deleted"); adUserFolder.Children.Remove(new DirectoryEntry(newUser.Path)); } newUser.Properties["AccountName"].Value = newUserInfo.AccountName; newUser.Properties["givenName"].Value = newUserInfo.firstname; newUser.Properties["sn"].Value = newUserInfo.lastname; newUser.Properties["displayName"].Value = newUserInfo.displayname; newUser.Properties["Address"].Value = newUserInfo.address; newUser.Properties["email"].Value =; //newUser.Properties["Password"].Value = "Y7l11909"; newUser.CommitChanges(); newUser.Invoke("setPassword:", "P@ssword:"); newUser.Properties["userAccountControl"].Value = 0x0200; newUser.CommitChanges(); } } } } This post has been edited by darkdexter: 02 March 2010 - 12:31 AM
Firing VB code when user clicks on asp:MenuItem   (153 Views)
I'm new to I created a menu just like the one found at the MSDN Framework Dev Center. Here's the code for the menu with a few basic modifications I made for event handling: [b] Sub NavigationMenu_MenuItemClick(ByVal sender As Object, ByVal e As MenuEventArgs) ' Display the text of the menu item selected by the user. 'Message.Text = "You selected " & _ ' e.Item.Text & "." End Sub [/b] Menu Declarative Example Menu Declarative Example I bolded the event handling portions of the code. I have a teammate that is working remotely to write VB code with the same name on each page, I made this menu part of a master file so that it appears on every page. Right now, the subroutine at the top of the page prints out
user control problem   (267 Views)
how to add a custom event like click event to a user control.. i want to right code of the user controls click event from where i use the user control.