C# - Role-management Provider Using Web.config?

Mar 18, 2011

I'm building a tiny web application with a simple user autentication scheme. I register the users in web.config, like this:

<authentication mode="Forms">
<forms loginUrl="~/login.aspx" defaultUrl="default.aspx" ...>
<credentials passwordFormat="SHA1">

[code].....

View 6 Replies


ADVERTISEMENT

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

Deployment Of Encrypted App.config - Failed To Decrypt Using Provider

Apr 21, 2010

I've created a console .Net application and encrypted the app.config file with RSAProtectedConfigurationProvider. It works fine in an IDE on my XP desktop. Then I deployed my application to a Windows 2003 server. The package included the app's executable along with the encrypted app.exe.config file.

However, the application failed on the server with the following exception: Unhandled Exception: System.Configuration.ConfigurationErrorsException: Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: The RSA key container could not be opened.

I decided to encrypt app.config on the server so I copied app.config and encrypted it. The app.exe.config looked encrypted and I ran the application. However, it failed: although it didn't raise an Rsa exception as before, it couldn't read a connection string. After I decrypted app.exe.config, I found that it contained only the below string

although the original app.config had contained an application-specific connection string. I think that in order to resolve my issue I should export the RSA keys from my desktop to the server. Can you advise how can I do it (it's not a Web application!).

View 1 Replies

VS 2008 SQL Provider Named Pipes Provider Error 5 Invalid Parameter S Found

Aug 3, 2011

i have 2 computers - a Server and a Client pc which is running on local area network with MICROSOFT SQL SERVER 2008 R2 Developer kit at the main pc and Client computer will need to connect to SQL SERVER at main pc using connection string.Let me named server computer as 'MAGNA-PC' and the client pc as 'LAC-PC' and database name is 'db_referafriend' so the code for MAGNA-PC(server) connection string is:[code] i GOOGLE and YOUTUBE for almost 2 weeks before i post . I know that i need to configure the sql configuration manager and enable tcp/ip also add a new port at firewall to allow remote connection also add the sqlserver.exe and sqlbrowser in firewall and I have also chosen "Using both TCP/IP and named pipes" under Remote Connections in the SQL Server 2005 Surface Area Configuration. and all of this doesnt work!

View 10 Replies

Asp.net - Getting Configuration Settings From Web.config/app.config Using Class Library

Mar 26, 2009

I have a class library (Named ADI), that needs some configuration settings from the project using it (like connectionstring, filesystem locations etc).

I want to define these settings in my Windows Forms/Web Projects App.Config or Web.Config, like other settings.

Here is part of my app.config for my windows forms application:

<applicationSettings>
<PhotoImportRobot.My.MySettings>
<setting name="ADIImageRoot" serializeAs="String">

[Code]....

View 3 Replies

C# :: Validate Dot Net Application Config File(ex, App.exe.config) On Console?

Jan 18, 2010

is there any tool to validate configuration file?

View 1 Replies

Asp.net - Class Needs Info From Either The Web.config Or App.config

Jul 6, 2011

Our main application has both a asp.net and winforms component. There is a class that is used by both sides and needs info from either the web.config or app.config files. The class itself does not know if it's on the client side or on the web server (at this point). We are getting errors when it's attempting read app.config when it's on the web side. Is there a way for the class to tell if it needs to read web.config or app.config?

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

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

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

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

ASP.NET Role Manager Feature Has Not Been Enabled

Jul 7, 2011

I'm trying to create a routine in my asp.net's main page that will see if the current user is a member of a Windows domain group. The site is hosted in IIS and is visible through our intranet.

GlenFerrieLive listed this code (which I'd like to use) in an earlier post:
UserName = System.Environment.UserName
If Roles.IsUserInRole(UserName, "MyDomainMyGroup") Then

[Code]....

Problem is, now I'm getting the configuration error 'Default Role Provider could not be found'.

How can I get around this? I just need to see if the current user exists in a specific domain group.

View 2 Replies

SQL Server Application Role Not Working In App

Oct 7, 2009

This desktop app written in VB.Net within VStudio 2008 fails when one of our "power users" tries to run the program: Select permission denied on object 'AcctLogon', database 'MDS', owner 'dbo'. The author of the app is out for a few weeks and I am the "fixer" while she's out. Both of our logins for SQL have permissions for db_owner in the MDS database but our user does not. The user has a Windows user login for this instance of SQL. This login has permissions for the public role only in the MDS database.

[Code]...

View 1 Replies

VB 2008 LINQ To SQL Classes - How To Use App Role

Feb 18, 2010

I am curious as to the proper technique to use SQL Server's AppRole with a LINQ to SQL Class. I understand I have to establish the intial connection with no connection pooling. However, do I simply call the SQL stored procedure sp_setapprole using standard LINQ before executing any of my methods that interact with the database, or is there a better way to enable and use AppRole within the LINQ to SQL class?

View 6 Replies

VS 2008 Using Express Edition In New Job Role?

Mar 6, 2010

Iv'e been away from Visual Basic for the past 3 or 4 years so I am a bit vague on the details that I am looking for.

I got myself my first programming job at the company that I work for and I start Monday.

The company has little programming knowledge (well I assumed this as they said they do not have a dedicated programming IDE at my interview) and relies on ad-hoc VBA scripts to perform necessary processing on data. This is all fine and I can deal with that but there is a project that I wish to work on and I think a standalone dedicated application would be much better than extending Excel with VBA.

Now after being with the company for 10+ years, I know they are conservative at spending money so asking them to buy Visual Studio is not really an option so I'm going to suggest that instead of using VBA, I will design an application using Visual Basic Express.

All I need to know is, if there are any kind of limitation to database accessing with the express editions? (Iv'e only ever used OLEDB connected to small MS Access files) I do not know what type of database the company uses yet, but I do know they use ODBC to connect to it, and rely on Sage to do 90% of their work.

View 5 Replies

Asp.net - Displaying Part Of Commandcolumn Based On Role?

Apr 14, 2012

I have a page with a gridview. The gridview has "Enable Editing" and "Enable Deleting" checked by default. I want to be able to "uncheck" either of these in the code-behind page_load event.

I found this SO question but this hides the whole commandcolumn. I only want to hide the "Edit" or "Delete" hyperlink based on the role of a user. How would I go about doing this?

View 1 Replies

Asp.net - Hide Web Link From Users Without Role Assigned?

Apr 4, 2012

I currently have some security working in my application by using the roles and rules, but i wondered whether it was possible to hide web links depending on if a user belongs to a certain role.I currently have it so users belong to either the 'admin' role or 'user' role. Rules have been setup on folders in my application so if a user belongs to either of the groups they can click on a web link and it takes them to the page. However, if a new user registers they belong to no role, and when they click on the web link it redirects them to the homepage (see code below). This is great, but, i wondered is it possible to hide that web link if the user did not belong to a specific role preventing them click on it. Also if a user belonged to no role could they be redirected to a page to tell them they need a role assigned?

<authentication mode="Forms">
<forms loginUrl="~/Homepage1.aspx" timeout="2880" />
</authentication>

I dont use this in the current application but have in the past, this checks if the user has been authenticated, i wondered whether i could use a similar IF statement for:If user.identity does not belong to 'user' or 'admin' role, then redirect them to page and display error?

If User.Identity.IsAuthenticated = True Then
Dim myUser As MembershipUser
Dim objUser As Object[code].....

View 2 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

C# - ASP.NET Directory Access With Role Based Security?

Apr 27, 2011

I have an ASP.Net portal like application with multiple roles. I have placed the subpages of that role in its own directory adding a web config with an authorization allowing only that role. I have css and javascript in the root directory that can not get access inside the protected role folders. How can I allow these folders css/js to have access to all roles. Sorry if this is easy question I have searched but I am rather new to ASP.NET

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

Hide Web Link From Users Without Role Assigned?

May 9, 2012

I currently have it so users belong to either the 'admin' role or 'user' role. Rules have been setup on folders in my application so if a user belongs to either of the groups they can click on a web link and it takes them to the page. However, if a new user registers they belong to no role, and when they click on the web link it redirects them to the homepage (see code below). This is great, but, i wondered is it possible to hide that web link if the user did not belong to a specific role preventing them click on it. Also if a user belonged to no role could they be redirected to a page to tell them they need a role assigned?

<authentication mode="Forms">
<forms loginUrl="~/Homepage1.aspx" timeout="2880" />
</authentication>

[code].....

View 1 Replies

Implementing Role Bases Security For An Application?

Aug 18, 2009

I wish to implement some role based security in my application. Has anyone got any links with some usefull info on this subject.

View 2 Replies

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

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

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

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

How To Handle Login/logout With Role Based Access

Jun 29, 2011

I have the membership provider setup and its currently pointing to a SQL database on my machine. The role based access works and I have a menu that is security trimmed. The user can only get to pages that they have access to.When an anonymous user tries to get to a page that they dont have access to it brings them to a login page so that they can login. That is fine. But when a logged in user tries to get to a page they dont have access to(Usually by typing in a URL) it brings them to the login page again asking them to login(except there already logged in. I'd like to either take them to a different page or somehow tell them they don't have access.

View 1 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







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