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


ADVERTISEMENT

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

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

Stop Two Users From Clicking One Link?

Feb 16, 2010

I have an website that has a datagrid that is pulling information from an SQL database. The user then clicks a link from that grid and is redirected to another page. My question is if a user clicks the first link and is redirected and then a second user clicks the link is there a way to stop that second user from being redirected or sent back to the first page after they click the link? So it would have to somehow detect on the second page that a second user has clicked the same link. Hope this is clear. This is being programmed in VS 2008 vb.net and SQL 2008

View 2 Replies

Make Picturebox1(function Already Assigned) Perform The Same Function As Picturebox2(no Function Assigned)

Aug 1, 2009

i wanted to ask how to make picturebox1 ,to which functions are already assigned, perform the same function as picturebox2 ,to which no functions are assigned.For example:I have already made picturebox1 and have assigned it alot of function like when play button is pressed then picturebox1.visible = true and when we press pause button picturebox1.visible = false. So now i decided to make a theme and have to remove the picturebox1 and want to allow the picturebox2 to havefunction of picturebox1.But when i disable the theme the function of picturebox1 should go back to picturebox1.

View 6 Replies

Administer Website (create New Users, Assign Users To Roles) From A Windows App?

Feb 9, 2010

I have an asp.net web app that uses forms-based authentication, a SqlMembershipProvider (using an encrypted password format), and a SqlRoleProvider. I need to know if it's possible to administer the users (create new users, assign them to roles, etc.) from a windows application - the powers that be don't want any administrative functionality in the web app itself.Here is the membership provider definition from web.config:

<membership defaultProvider="MyProvider">
<providers>
<add name="MyProvider"

[code].....

View 3 Replies

VS 2008 Database Search - Using SQLClient That Loops Though All Users In A Users Table

Dec 29, 2010

I've got a code using SQLClient that loops though all users in a Users table inside each loop i want to preform another search in the UserOrders table, thus doing a count of all orders.

I get this error

HTML

There is already an open DataReader associated with this Command which must be closed first.

Here is my code

vb.net UserLists.Items.Clear()
Dim connection As New SqlClient.SqlConnection(My.Settings.ConnectString)
Dim command As New SqlClient.SqlCommand("SELECT * FROM Users ORDER BY PersonName",

[CODE]...

View 3 Replies

.net Desktop App : Log Users Application's Usage By Users After Remote Deployment?

Apr 3, 2012

1.I�d like to publish a free vb.net desktop application for the users to download and use meanwhile I�d like to collect usage information ex: user ip address, user�s registration information, used features, time spent� if the user allows the report to be sent back.

2.Also , in order for the user to be able to use the application, he�ll have to register it then, everytime, before the application loads, it gets verified online that it was registered, maybe validate the registration information or a valid user name and password, no critical personal information. The target of this step is for the application to be used exclusively by the registered user and maybe on his computer only.

View 2 Replies

Vb.net Desktop App : Log Users Application's Usage By Users After Remote Deployment

Apr 4, 2012

1. I�d like to publish a free vb.net desktop application for the users to download and use meanwhile I�d like to collect usage information ex: user ip address, user�s registration information, used features, time spent� if the user allows the report to be sent back. 2. Also , in order for the user to be able to use the application, he�ll have to register it then, everytime, before the application loads, it gets verified online that it was registered, maybe validate the registration information or a valid user name and password, no critical personal information. The target of this step is for the application to be used exclusively by the registered user and maybe on his computer only. Any alternative way to achive the target is just fine.

View 1 Replies

Get Path Of 'All Users' Desktop And 'All Users' Start Menu

Jun 10, 2008

I cannot figure out how to get this call to work.I have searched EVERYWHERE.MSDN is no help at all and the only thing I can find is this vb6 code that doesn't work in .net.I tried to convert it over but I've had no luck.Specifically I'm trying to get the path of the "All Users" Desktop and the "All Users" Start Menu.It would rock if anyone could help me out with this one.

View 5 Replies

Hide/Show Items - Possible To Hide A Group Of Text Boxes From View In A Form

May 5, 2012

I'm curious if it is possible to hide a group of text boxes from view in a form until a particular condition is met, and to have a custom set of text boxes for that condition. To give an example; I want radio buttons offering choices for a manner of searching records, the user selects one and then a specific set of text boxes are displayed for the user to utilize, if a different option is chosen a different set of text boxes will be shown. Is this something that can be done?

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

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

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

VS 2010 Make The Download Manager Know It Is Link To Downloadable File As Opposed To Something Like Link To Another Webpage?

Dec 4, 2010

I'm using visual basic 2010 express..I'm building my own web browser and want to add a download manager.I have been able to build one that will download a file if I type the file location into a text box.What I'm trying to figure out is how to have the download manager open when I click on a download link on a web page.How to make the download manager know it is a link to a downloadable file as opposed to something like a link to another webpage?

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

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

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







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