ASP.NET Membership Check If User Is In A Role In Custom Class

Jan 17, 2010

In my VS solution, I have two projects.One for the Web Interface, other for DataAcess and BusinessLogic. I know I can check if the currently logged-on user is Employee in Web Interface project like this from the code behind:

Dim isEmployee = User.IsInRole("Employee")

The problem is that I have a Class call UserManagement in my the DA and BL project which I want to check the currently logged-on user role also. I can't use Dim isEmployee = User.IsInRole("Employee") because it doesn't have aspx page.

What do I need to do to check the user role in my custom class?

View 2 Replies


ADVERTISEMENT

VS 2010 ASP.NET Membership Role In Windows Application?

Oct 4, 2010

i already create new connectionstring in app.config that point to myDB i already create aspnet membership table in myDB using aspnet_regsql i already create new custom provider and set the connection string there.. what i like to ask:

1. why when the app start, it create new folder app_data which contain aspnetDB.mdf eventhough i already create new connection string ?

2. why when i'm using Membership.CreateUser method, it succesfully inserted in myDB.aspnet_Users table but when i'm using Roles.CreateRole method it doesn't inserted in myDB.aspnet_Roles table?

PS: i'm using .net 4.0, sql2008, vs2010

View 9 Replies

Custom Membership For Dot Net Nuke

Dec 11, 2009

i am new in dot net nuke.i just found that there is open id logging option in dot net nuke.And so i did need user to register afresh in my dnn application.This is because i have another mvc application which i would like to be the openid provider for my dnn application.and am totally confused on how to go about that? Again,is it possible to tamper with dnn membership such that i use aspnetsqlmembership?

View 1 Replies

When I Create The User And Assign The Role, The User Should Get The Permission Automatically?

Nov 24, 2011

I need to define some roles in my program with defined permissions. Let's say the administrator can have access only to certain features. The officer in charge to certain features and the user as well. for example, I have several group boxes and the user can access one of it only. So how i do manage these permissions? What I want do is have the roles already with the defined permissions. When I create the user and assign the role, the user should get the permission automatically.

View 6 Replies

Asp.net - Custom Role Provider With ActiveDirectory Authentication

Feb 21, 2010

I'm creating a custom Role provider based on the ASP.NET Role provider. I have 3 tables. One for Users, one for Roles, one for UsersInRoles.The Users table has no password column because the users are authenticated with ActiveDirectory. That's my approach so far. I can't get the cusstom Role Provider to work, anyone has the same situation like me. How do you make a custom Role provider works with AD?

View 2 Replies

Check To See If A Given Username Is In A Certain Role?

Jul 6, 2011

I have an ASP.NET application on our company's intranet. And a funky security requirement.

I need to check to see if a given username is in a certain role. I cannot use

Page.User.IsInRole("MyDomainMyGroup")

because

Page.User.Identity.Name

Returns an empty string. Because of some lovely specifications for this program, I have to keep anonymous access enabled in IIS. Seems to rule out any page.user.identity stuff.

So I did find a way to (at least) get the current user (from System.Environment.UserName), but I need to bounce it against the domain group to see if they're in it. Or, better yet, get a list of users within a given domain so I can check myself. Something like...

Dim UserName as String
UserName = System.Environment.UserName
If User(UserName).IsInRole("MyDomainMyGroup") Then

[Code]....

View 1 Replies

VS 2008 Using Custom Membership Provider In WinForms?

Feb 8, 2010

I would like to use my custom membership provider (which is working in my asp.netapplication) in my windows forms application.I thought this would be relatively straight forward, and followed these steps:1. Copied MembershipProvider class into my application.2. Add reference to System.Web3. Create app.config with membership settings i.e:

View 3 Replies

Sql Server - Insert Asp.net Membership-generated UserId Into Custom Table (vb)?

Nov 18, 2010

I've spent a couple of hours trying to find the answer to this, and although there are tutorials all over the 'net none of them work for me (or I am too n00b to understand what they're telling me.I'm creating users in asp.net using Membership. What I want to do is add the generated UserId to a column in a custom table I've created, to link the stuff in the custom table with the user created in aspnet_Users.

[Code]...

View 2 Replies

Check A Users Role Before They Are Routed To A Web Forms Page With ASP.net 4.0

Feb 7, 2012

I have an asp.net web forms application that uses asp.net membership and URL Routing.Because of the way Roles work, i cant put an "AND" or "OR", etc. in the allow/deny tags of the web.config file that resides in each folder.This is a business website that that is being ported from a vb.net win forms project that contianed many apps. (The win forms project have a custom authentication system.)The web app is structured in a way to mimic the desktop suites and a folder was created for each app.There are also common folders where any user of any app can generate a report.

View 1 Replies

Asp.net - Add User To A Role When Registering?

Jan 7, 2012

I have a role called "Customer", I wish to add users who register to be to automatically added to that role. At the moment I can only assign users to roles by using ASP.net Web Site Administration Tool.If it helps: I'm using the default login.aspx and register.aspx files from Account folder in vb web profile.

View 1 Replies

Building Custom User Control - Default Property Of Class?

Jan 22, 2012

If we say blue is the default colour of the Backcolor property I understand it as if you don't specify a colour for Backcolor blue will be its colour. But I could not make sense of default property of a class in the context of building a custom user control. After calling an instance of a class we have to either call one of its members or assign an other object for it. Therefore why should there be a default property?

View 9 Replies

Asp.net - Redirecting Based On The User's Role?

Nov 9, 2011

i'm having some problem over here..when user enter their id and password,it will show up the main page and its for user but when admin or staff enter their id,it will enter the user's main page and i have to click admin site on the top hyperlink where it automatically logout and once i enter back admin passwrd or staff passwrd then only it redirect to admin page or staff page.how to make it like once user enter their passwrd it redirect to user page and once admin enter admin password or staff enter their password in the login it redirect to admin or staff ?I have 3 roles over here which are admin,staff and user.Hereby i'll provide you my aspx code and also my vb code which is running behind the program.

[Code]...

View 2 Replies

ASP.NET Redirect User Based On Role?

Jan 23, 2012

I want the app to redirect a user to a different home page depending on their role. Its currently working for 2 users using the following IF?

If Request.IsAuthenticated AndAlso User.IsInRole("Staff") = True Then
Response.Redirect("~/About.aspx")
ElseIf Request.IsAuthenticated AndAlso User.IsInRole("HR") = False Then
Response.Redirect("~/HRHRCompanyNavigation.aspx")
End If

How can I get this to work for more than 2 user roles?

View 1 Replies

Get The Logged-in User From ASP.NET Membership?

Dec 12, 2009

(I work on VS 2005 with Access Database and C#)

I have my code as follows:

protected void Page_Load(object sender,
System.EventArgs e)
{

[Code]....

The logged-in 'UserId' and 'UserName' is getting displayed correctly, but now how do I use the string 'lmember' in my 'SELECT' statement when I need to display the related information from the table 'aspnet_Users' for the logged-in user? getting the following select statement:

SelectCommand="SELECT * FROM aspnet_Users WHERE (UserName= ????)"

View 1 Replies

Create A User Control With A List Of Custom Class Type Property

Nov 29, 2011

Is it possible to create a user control with a list of custom class type property? If it is, how can I? The issue is that, in designer mode the property is not displayed in property window. I can add the list on markup but when i switch to the designer mode it gives an error which is 'The user control does not have a public property named BookList'.

View 1 Replies

Asp.net - Retrieve The Currently Logged In User Role Name In Textbox ?

Dec 14, 2010

How to retrieve the currently logged in user role name in textbox using vb.net ? iam currently using

TextBox1.Text = Roles.GetRolesForUser(User.Identity.Name)

om page load event but it is highlighted by a blue line in visual studio 2008

View 1 Replies

Asp.net Mvc - Testing User Role Authorize Attribute In .NET?

Jan 23, 2010

I am using ASP.NET MVC to build a site. I am using VB as programming language.I have couple of questions.

1 I have created a role "Manager". How Do I check if a user belongs to this particular role?

For now I am using If My.User.IsInRole("Manager") Then 'Direct to a view Else 'Direct to another view End If Is this the right way? 2 How to use the Authorize attribute to limit access to a Function?

I know in C# it goes [Authorize (Roles ="Manager")] but not sure in VB. Also can I define property to redirect a user who does not have "Manager" role to a particular view when trying to access this function .

View 1 Replies

Disable Nodes In Treeview By User Or Role?

Jun 2, 2011

How to disable node of treeview by user or role in winform

View 10 Replies

C# - Update User's Role From A Dropdown List Within A Repeater

Jul 5, 2010

I have repeater which shows a list of users and there roles. There is also a dropdown list to chnage there role see below

<td><asp:DropDownList ID="ddlChangeType" class="controlwidth100" runat="server" AutoPostBack="true" OnSelectedIndexChanged="change" /></td>

the change event works but what I need is the ID of the row so the user can be updated.

View 3 Replies

Selecting Rows From Different Tables To Update User Role?

Mar 2, 2012

what i have is 3 text boxes

User
Role
Upgrade To

and a gridview

what i am trying to do is :when i type in the user the system will look in my table cg_security_user and recognise that the current role is "guest". Then in the Upgrade to when i type in "admin" it will update the current role(guest) to admin here is a picture is attached of what i am trying to do as it might paint a better picture the code which i have made so far is

Private Sub cmdupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdupdate.Click
Dim myAdapter As New OleDbDataAdapter
strsql = "update table1 set studname = @field2, studaddress=@field3, studage=@field4 where studid=@field1"

[code]....

View 4 Replies

.net - Create New User In Winforms Using HDI Membership Provider?

Jan 1, 2012

I have a website with login and register forms using custom HDI Membership provider where Users can login or register new account.

Now I have a desktop software and trying to have two forms for login and register where my users can able to login or register for user convenience and not by going to the website and make them register online.So, I have these to know in order to go further.

1) Can I use HDI membership provider as I have used it in my web application?As previously I have done and I faced many problems and still didn't get clarified here

2) If No, how do I make use in order to make use the same HDI Membership.Finally I need to use the same database for my desktop software as well as my web application with all the possibilities (i.e. I need to validate each parameter of my membership class).I am able to register the user but it is not using the Membership and I'm unable to know why it is not picking up the membership provider from the app.config file.

View 1 Replies

Active Directory User Group Membership?

Jul 14, 2009

Active Directory User Group Membership

View 4 Replies

Membership - Getting Error When Trying To Update User Details

Feb 21, 2011

I am using asp.net membership and trying to update a users details but get the following error:
Error 2 Overload resolution failed because no accessible 'New' accepts this number of arguments.

Below is the full .vb code:
Partial Class FamilyAdmin_edit_user
Inherits System.Web.UI.Page
Private username As String
Dim user As MembershipUser
Private Sub Page_Load()
[Code] .....

Before I had:
Dim user As MembershipUser

And got the error:
Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:
System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:
Line 20: 'parameterless
constructor Line 21: Line 22: .....

View 1 Replies

Possible To Retrieve Users Profile Using Their Membership User Id?

Feb 19, 2012

Using the Asp.net Membership & Profile Providers: Am I able to retrieve a user profile using their Membership UserID instead of their Username?The reason I ask is because if I have the UserID and not the Username I would have to write the following two lines of code [code]Dim Profile As Profile = Profile.GetProfile("UserID")Will this affect performance? Is my design bad? Am I missing something? I am aware that I can retrieve the current logged in user using the following code: HttpContext.Current.User.Identity.Name

View 1 Replies

VS 2005 Get User's Security Group Membership?

Apr 18, 2011

Is it possible for a VB.NET web application to check the user's Windows security group and behave differently accordingly?I'd like to disable a certain bit of functionality if the user does not belong to a specific windows group.I've tried using the Microsoft code at url... but get the error "Reference to a non-shared member requires an object reference" on the "irc = WindowsIdentity.Groups" line (I have imported all the required namespaces).Does anyone know if it's possible to get the user's security group?

View 1 Replies

Asp.net - Show Failure Text If The Loggedin User Role Not Found?

Apr 9, 2011

How to display login failure text if user logging in user role id differ than vendors role ... i m using the following code to authenticate user role during logging in

[Code]....

View 2 Replies

Disable Registered User Account In Asp.net Membership Using Checkbox?

Nov 29, 2010

How to disable registered user account in asp.net membership using checkbox ?

View 1 Replies

Retrieve Profile Information For An Asp.net Membership User Account?

Oct 26, 2010

I want to pass an asp.net membership user name to a subroutine and retrieve the profile property named FullName for that user, how can i achive this in vb.net?

View 2 Replies

Create A Custom Class That Has Inside An Array Of Another Custom Class?

Jan 31, 2011

I want to create a custom class that has inside an array of another custom class (see my code below) but when the programm runs is crashes. Why? What is the right expression???? Plz help I'm a newbie in VB.net.....

Public Class ctrarray
Public nameclass As String
Public ctrlindex(glvar_spaces) As ctrlindexclass
End Class

[code]....

View 6 Replies

Asp.net - Validate User Role During Login Button Click Event In Login Control?

Apr 9, 2011

I have a login control in my asp.net webform i uses the roles manager...i have two roles admin and vendors i want when user enter username and password in login control then on login button click event it validates either the user is admin or vendors if vendor is admin then it will redirect to default.aspx other wise stay on login page with error. ...how to do this using vb.net ?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved