ASP.NET MVC Custom User Roles / Profiles

Jan 15, 2010

I am creating a website using asp.net mvc model. When you create an mvc application asp.net automatically creates roles/profiles for user and admins (as far as i know) and corresponding tables in sql server database.I a need a new profile/role names "sponsor" that has all the benefits of users/admins (like authorization etc).

View 1 Replies


ADVERTISEMENT

Winforms - Use Custom Roles For User Access?

Sep 2, 2009

I have a winforms (VB 2008) based app that I'm developing and I want to use custom roles for user access.Application Layout:I have a Main form that opens a login form when certain actions occur.The Login form intern uses an authentication class that I've created, to authenticate users and set access rights.On my Applications settings page, I have Authentication Mode set to Application-defined because I cannot use Windows Authentication in the environment where this will be deployed.

The application uses a MS SQL 2005 db and the 3 tables I'm using in the authentication process are the User_Account , User_Roles and User_Access tables. The combination of an account in the User_Account and the roles within the User_Roles table are the bases for the User_Access table. Using the User_Access table is how I assign access to the various functions within the application

Authentication Method:To authenticate a user, I'm using the "My.User.CurrentPrincipal" (Code below) method. The My.User object works great and allows the use of "My.User.Name" property throughout the app when referring to the currently authenticated user.

Access Method:In order to set the current users access levels I'm using a function within my Authentication class and passing in My.User.Name as a variable. The function uses a Dataset Table Adaptor and a Select Case statement inside a For loop to assign all the access levels for the user (Function code below).

My Problem:This method of assigning access rights to a user does work but it's not persistent throughout the application as the My.User object is.I would like to find a way to create custom roles through the My.User object using its .IsInRole property. I would like to have these roles dynamically created using my User_Roles table.This would allow the custom roles to be used throughout my application using the My.User.IsInRole ("MyRole")syntax ...similar to how I'm currently able to use My.User.Name.Unfortunately the only roles I can currently validate against are the built in Windows
type accounts (Adminisrator ...ect.).

'User Authentication example:
If Authenticate.CheckPassword(tbxUserName.Text, strPassword) Then
My.User.CurrentPrincipal = New GenericPrincipal(New GenericIdentity(tbxUserName.Text), Nothing)[code].....

View 1 Replies

Implement Custom User-roles In Windows Application

Apr 21, 2010

I am looking for ways to implement custom user-roles in windows application with vb.net. I got a database table called Roles with Administrator and User entries. User cannot see some of the form data. In ASP.NET MVC we can do like.

[Authorize(Roles = "Administrator")]
public function GetAccount() as Array

End Function

View 1 Replies

Application/User Settings With Roaming Profiles?

Nov 10, 2009

We have an application that's installed at several locations but we are having an issue at one particular site. In short the application settings (My.) are not being saved after a reboot. The application is build in VB.Net v3.5 Framework and we are not experiencing any issues elsewhere.

This particular site is using roaming profiles and the network administrator ensures us that the correct permissions are applied to the user account(s) and all application data is being saved to the server. I've asked the network admin to check for the existence of the user settings file user.config in the Application Data directory and he says it doesn't exist.

In our application we store the connection string to the database in the application settings under the user scope. If no connection string is present or if one is present and a connection to the database cannot be made then a form is shown asking the user for the database credentials. Each morning when the users boot the machine and opens the application for the first time they are asked for these credentials but if they close the application and restart it they are not asked for them. This indicates to us that the settings are being saved but once the pc is rebooted and the application is opened for the first time they are asked for the database credentials. This seems like the settings are not persisting after a reboot.

View 1 Replies

VS 2010 : List All User Profiles On A Computer?

Nov 20, 2011

I have vbscript code that enumerates user profiles from this registry path:

HKLMSOFTWAREMicrosoftWindows NTCurrentVersionProfileList.

How can this be done using Visual Basic 2010? Is there a class or method that I would use to accomplish the same thing or would I have to read the registry path into an array as you do with vbscript? My application will be ran on the local computer just so you know this information is not being gathered from across the network. I have been looking for awhile and haven't found anything that will work so far.Once I have the user profiles from the computer, I will populate this list into a drop-down combo box.

View 2 Replies

Use Custom SqlMembershipProvider To Store Users (and Roles) In Cache?

Feb 15, 2011

I'm developing a "small" warehouse-management WebApplication for few users(5-10 parralel) but with a complex authorization system(checking if pages,menus,TabPanels, UserControls and even single controls are visible or enabled) and permanent and frequent access. Because i've only limited experiences with the ASP.Net MembershipProvider, i'm unsure what's the best approach for following goal:

I want to hold all users, roles and frequently used masterdata in the Cache(in a Dataset). Hence every readonly access should be faster and causes less traffic than always using the database. On updates,deletes and inserts i would update the cached dataset and also the database.

Can i use or extend the SqlMembershipProvider to achieve this goal and if possible how?

View 1 Replies

(SQL) List User Roles Via SMO

Jun 21, 2010

Is there a method for checking which roles a user has in SQL using SMO? I can add a role via: user.AddToRole("Administrators") But cannot see an obvious method to progmatically list them.

View 2 Replies

Add User To Roles During CreateUserWizard.CreatedUser Step?

Jan 22, 2011

How to add user to roles during CreateUserWizard.CreatedUser?What's wrong in this code:

Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As EventArgs) Handles CreateUserWizard1.CreatedUser
Dim username As TextBox =

[code]....

View 1 Replies

See If Current User's Group Name Matches A Specified Group Name Using Active Directory Roles And SID's?

May 3, 2011

I'm trying to match up a specific group name and see if it exists for the currently logged in user using Active Directory roles. If the Group Name exists for the Current User, I want that group name to be displayed in a drop down list. Example: If current user is in BIG Group, display BIG in drop down list.Problem: All I am getting is SIDs and I'm not able to get anything to match up to the group name and nothing will show up in the drop down list.I also get the following Error:Error: Object variable or WIth block variable not set.How do I fix this?? here is the code I am using:

Private Sub GetMarketingCompanies()
' code to populate marketing company drop down list based on the current logged in users active directory group that

[code].....

View 3 Replies

Using Profiles In ASP.NET?

Aug 31, 2011

in my vb code i'm trying to add to the profile by using this code:

profile.FirstName = "John"

But I keep getting an error saying:

FirstName is not a member of profile.

View 1 Replies

Custom User Controls - Correct Size With User Choice

Sep 27, 2011

I have some custom user controls in my .net winforms program that do not display correctly when the user has selected larger text size. This setting:

My controls look like this:
Instead of like this:

The bill to area and ship to area are both custom controls. I don't know if this is contributing to the problem but I do have code in each to scale the phone/fax areas to stretch nicely, like this code from the bill to control,

Private Sub panFaxPhone_Resize(sender As Object, e As System.EventArgs) Handles panFaxPhone.Resize
panFax.Width = (panFaxPhone.Width / 2) - 1
panPhone.Width = (panFaxPhone.Width / 2) - 1
panFax.Left = panFaxPhone.Width - panFax.Width
End Sub

How can I get my controls to size correctly while still respecting the users choice for larger text (I don't want to just set the AutoScaleMode to None)? After playing with this for a long time it seems to be a problem with anchors in the child controls. See this below image, the inner black box is the control with its border turned on, the text boxes (like name) are anchored left and right and should stretch to fill the control, but don't.

View 1 Replies

Incorporate INI Files For Profiles In Order To Quickly Pull Up Data From One Person To The Next?

Nov 1, 2011

I am attempting to create a basic program and I need to know how to incorporate INI files for profiles in order to quickly pull up data from one person to the next.

Public Class IniFile
' API functions
Private Declare Ansi Function GetPrivateProfileString _
Lib "kernel32.dll" Alias "GetPrivateProfileStringA" _

[code]....

And placed it into a module, which I then wen't to my main program and attempted to place this:

Dim ini As New IniFile(Profiles.ini)
Dim value As String = ini.GetString("Names", "1", "Default Value")

To attempt to retrieve the data, but I get no error or information from it. The ini file is inside the folder of the project and I set the SectionName and KeyValue to the corresponding names. I think I am having trouble with syntax? Not 100% sure. This is the code that I got from the same source as the module for using the module.

Dim ini As New IniFile(FileName)
Dim value As String = ini.GetString("SectionName", "KeyName", "Default Value")

And I adjusted to what I believed would be the proper format.

View 7 Replies

Using Roles In MVC 3 App

Nov 4, 2011

I have an issue to do with roles in mvc 3 vb.net app..Say I have Admin, Developer, PowerAdmin roles.. if I want to restrict view options based on roles I have been using a if statement in the view to hide the link all together such as:[code]I am also decorating controller actions with authorize in places. The Problem is this say I have several actions that should only be available to say a user who is in all three roles or even 2 of the roles in any combination.. Would I simply nest the if statements in the view to hide those view items? What about controller functions.. Is it possible to decorate controller functions with something like [code]and then have that function only accessible by someone with both roles????

View 2 Replies

Change Database Roles In SQL Through VB

Apr 23, 2010

I fiqured out how to create a new user in vb for SQL, but when I try to access the database, I get a select error. I went into SQLMSO and changed the membership role to db_datareader and db_datawriter and ran my form again and I was allowed to delete and add records. Is there a way with the below to add a user and let them add and delete records.

[Code]...

View 1 Replies

Roles Only Returning 1 Role

Jun 16, 2010

I am having a problem with my roles Identification. I am try to read all the roles for a given user. No matter what I try only the first role, only 1 role for the user is being returned. My code is as follows.

[Code]...

View 3 Replies

Open A Specific Tab In Condition That "Profiles.txt" Is Not Found?

Jan 20, 2009

I want my program to open a specific tab in condition that "Profiles.txt" is not found. It already opens the Control Panel, but it needs to go to the "Add Players" Tab in the Control Panel automatically.
Is there a way to do that?

Also, I have a couple of advanced tabs that should be disabled or hidden until certain conditions are met.

View 3 Replies

Asp.net - Setting Up Different Roles Depending On Url In Web.config?

Jan 17, 2012

<authentication mode="Windows"/>
<authorization>
<allow users="USERS"/>

[code]....

Is there a way to write an if statement in here to detect what url I am on so I can allow a certain role for that certain URL.

Example code in my head of what I kind of want to see:

If (UCase(Url) = UCase("URL")) Then
<allow roles="ROLES"/>
ElseIF(UCase(Url) = UCase("URL")) Then

[code]....

Is this even allowed in the web.config? I have 3 websites. One for Dev, UAT and PROD. Now for each sites I have different user groups for each set up. I just want to find a way that I can just find what URL i'm at and point it at the certain user group. I'm guessing I have to make a web.config for each because you can't do conditional statements but I'm just making sure. If I have to make a web.config for each how can I go about setting that up?

View 3 Replies

How To Show Roles Based Menu

Dec 9, 2009

How to show menu according to their roles in vb.net2.0

View 8 Replies

Vb.net - Membership Roles.GetUsersInRole Not Working For Me

May 13, 2010

[code]...


The code above throws a "Specified method is not supported." exception on the first line.
Any one knows what am doing wrong here?

View 2 Replies

How To Add Hide Two Roles From String Array .GetallRoles()

May 30, 2009

I want to hide two specific roles from string Array(Admin,Member). Right now it lists all the roles

in my checkbox control. This is my code.[code...]

View 2 Replies

Roles.getallroles Method Not Appearing With Intellisence?

Apr 14, 2009

Trying to retrieve all roles for a user. Thought maybe I could select by User.

When I key " roles. " the getallroles method does not appear as an option. I get "Add,AddRange,BinarySearch,Capacity,Clear,Contains,Count,IndexOf,Insert,Item,Remove,RemoveAt,Sort,ToArray".

View 2 Replies

Sql Server - Roles And Permissions In Windows Forms

Dec 7, 2011

I am wanting to update our current windows forms security to something a lot more flexible. At the moment we have a single column in thew users table which is named 'Access_Level', this field holds an int value (1 to 4) which is then use to determine users access to certain areas of the application. This worked fine when the system was small, but the system is growing rapidly now so I think it is a good time to update the user access and possibly introduce roles.

[Code]...

View 1 Replies

Custom Event In User Control

May 10, 2011

I've got a page (aspx) that contains a usercontrol (ascx).On postback of the aspx, I'd like to read some control values in the ascx. So upon reading some good articles, I created an event in my aspx that fires on postback.The event handler is in the ascx, and simply writes the values I'm interested in to the viewstate so that the parent page can read them.The problem is my event handler never gets hit, even though I see the event is raised as I step through the code. So my code bombs when trying to read the viewstate (which is empty)[code]Oh, did I happen to mention I'm dynamically loading the ascx? :)

View 2 Replies

Custom UI - Customize The User Interface In VB

Jan 30, 2009

How can I customize the user interface in Visual Basic .NET and is there stuff you cant do in Vb.net that you can in higherj level languages usch as Java and C and C++?

View 4 Replies

How To Declare The Custom User Controls

May 12, 2010

I am getting this annoying warning message "Object reference not set to an instance of an object." all the time because I created several custom user controls and drag it to a Windows form in a vb.net Windows application. I am using vs 2005 and dot.net framework v 2.0. This message pop up when I try to save the projector when I try to debug it in the Design mode.

View 2 Replies

Inheriting From A Custom User Control

Oct 28, 2011

I have a component class that inherits a user control class and i'm trying to inherit from that same class in a new class.public class B inherits class Unfortunately, I get an error pointing to the .g.vb file saying:Base class 'System.Windows.Controls.UserControl' specified for class '...' cannot be different from the base class '...' of one of its other partial types When I swap the "Inherits System.Windows.Controls.UserControl" with inherits from the base class in .vb files the program compiles but when I try to access any of the components I get an error saying "Object reference not set to an instance of an object."Why is it doing this? it's as if the my sub class isn't inheritingUserControl method at all.

View 2 Replies

Using Custom User DLL's In .NET 2010 Project?

Sep 21, 2010

I have a dll I created using VS 2008. I was able to add a reference to it in all my VB.NET projects built in VS 2008 with no issues. I added a reference...added an import statement....created a reference in my code and viola! All is good. I recently switched to VS 2010 and tried to re-use my trusty dll file in my new vb.net 2010 projects and all is good until I try to build and/or run the project. I get the following error whenever I try to do either...

'Type 'CustomFunctionsClass2010.CustomFunctions2010' is not defined.'I have tried all sorts of things from rebuilding the dll from scratch in the new VS 2010 IDE to changing where the file is stored on the network to placing the dll on my local drive and nothing seems to get me past this error. I even tried placing the dll in both the debug and release folders with no luck or change in the error shown. Am I stuck just not being able to write and use my own dll's?Here is a snippet showing how I am using it in

Imports CustomFunctionsClass2010.CustomFunctions2010
Public Class GetShowTimeData
Sub GetShowTimeData(ByVal dtStartDate As Date, ByVal dtEndDate As Date)

[code].....

View 9 Replies

C# - Storing Static Files To Be Shared Among Azure Roles

Sep 13, 2011

I'm trying to host some static files for access by an ASP.Net web role and a separate data worker role that are both running on the same deployment (they use a global static interface).

However, I'm unsure how exactly to 'host' them, I've tried using virtual folders via HttpRuntime.AppDomainAppPath, but it only occasionally works in debug mode. The files also don't seem to get packaged into the deployment packages made by VS vis CSPack (though this might be a separate issue, is it possible to fix this too?)

The static files in question are actually WordNet, which I'm using through WordNet.Net, If that makes any difference. I also need the solution to work in both the cloud deployment and the emulator (if possible).

View 2 Replies

Use Membership Roles Using Sql Provider In Windows Forms Application?

Nov 22, 2010

Is it possible to use membership roles using sql provider in windows forms application

View 1 Replies

Custom User Control Graphics Rotation?

May 31, 2010

I'm trying to build a dial control as a custom user control in VB.NET. I'm using VS2008.so far I have managed to rotate image using graphics.rotatetransform . however, this rotate everything. Now I have a Bitmap for the dial which should stay stable and another Bitmap for the needle which I need to rotate.so far i've tried this:

Dim gL As Graphics = Graphics.FromImage(bmpLongNeedle)
gL.TranslateTransform(bmpLongNeedle.Width / 2, bmpLongNeedle.Height * 0.74)
gL.RotateTransform(angleLongNeedle)[code].....

As I understand it, the image of the needle should be rotated at angle "angleLongNeedle" although i'm placing the rotated image at 0,0. However, the result is that the Needle doesn't get drawn on the control.

View 2 Replies







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