Security :: Redirect URL On Conditional Roles?
Jun 3, 2010
What I want I'm trying to do seems very simple, but I'm having difficulty in understanding what modifications (properties or classes) to make and where (web.config? source code? master.site?)
All I'm attempting to do, using the login.aspx script in Visual Studio 2010, and based on the roles to which I had configured in the ASP.NET configurator, to include access rules, is redirect users to different URLs based upon whether they are Admin or Manager or User.
I'm seeing many different suggestions on the internet, I don't know where to start. =/
View 4 Replies
Similar Messages:
Mar 10, 2010
I am currently having a spot of bother in something im trying to create. I want it so when a user who is in a certain role logs in they are directed to a certain page, and any other normal users are directed to another page.
I think i have this sorted via code but...
-The first time it will work, the 'admin' user will get directed to the appropriate page
-I then log out and log in as a normal user and get directed to the appropriate page
-then when i log out of that users account and back into the admin one i get directed to the normal users page instead.
-additional to this, I tried it on a different machine logging in as the admin user only to be redirected to the normal users page (is my session being stored somewhere?)
Ive traced through the problem and the user name and password being subbmitted are what they should be, yet it skips the true part of my IF statement for being in that role.
Here is my code I am using on the login form:
[Code]....
-When stepping through if seen it work and not work with the same values, I cant understand the logic of its inconsistency
the code i am using for the logout is (this is on my masterpage):
[Code]....
View 4 Replies
Jul 4, 2010
I have implemented membership and enable role based on. I have 2 roles "admin" and "super_admin" and once the user login, I want to redirect them to different folder based on their role. My guess is, the redirection need to be determined once the user clicked login on the login control and here is my code.
[Code]....
However, whenever the user login (regardless of admin or super_admin) the page keeps redirection to Anyone/Default.aspx.
View 5 Replies
Oct 26, 2010
Is there a tutorial on how to redirect user to a specific web page based on his/her role? For example, I have teacher role and student role. When the teachers login, it will redirect the teacher to the teacher web page and the students redirected to the student web page.
View 1 Replies
Sep 12, 2010
I am using Formsauthentication. My situation is as per below:
the login form has codebehind :
protected void LoginButton_Click(object sender, EventArgs e)
{
TextBox uname = Login1.FindControl("UserName") as TextBox;
TextBox pass = Login1.FindControl("Password") as TextBox;
CheckBox rm = Login1.FindControl("RememberMe") as CheckBox;
Literal fail = Login1.FindControl("Literal1") as Literal;
if (Membership.ValidateUser(uname.Text, pass.Text))
[Code].....
Now the problem is that when I try to login with proper credentials it first redirects to default.aspx( there is no such page in my project), after login again with same credentials it properly redirects to the correct page. Why such problem arises? to fix this?
View 6 Replies
Apr 1, 2011
I'm trying to redirect requests that have a query string to a different domain name.I've got a short url, http://short.url and I want to redirect http://short.url?hello to http://long.url/?hello. So the query string has to be kept by the redirect. To make things more complicated, I would like to rediect http://short.url?hello,hello2 to http://long.url/advanced.aspx/?hello,hello2.Here is the rule I've got now (only dealing with the first part of my question)
<rewrite>
<rules>
<rule name="test" patternSyntax="ECMAScript" stopProcessing="true">
[code]...
However, I am not seeing any redirects. Also, is there a better way to do this? Basically I just want to setup a shortcut to pass queries to a website. These are not meant to be permanent so I'm using redirectType="Found".
View 1 Replies
Mar 7, 2011
I have a multi level application that I am developing and need to block multiple rows from being joined. I know how to hide one role but I cannot figure out how to hide multiple.
Here is my current code
[Code]....
View 2 Replies
May 17, 2010
Newb question: what is the standard practice for assigning roles to newly signed-on members. Is it usually manual or is there a way of automatically assigning roles. Being completely new to this, I am confronted by the issue of my site having three different roles that new members could fall into, but am unsure about how to assign each a role. I can't imagine having to go through the process manually if I have thousands of members.
View 6 Replies
Apr 24, 2010
[ASP.NET 3.5, FormsAuthentication, SQL Server]
In the Roles table there is Role, and RoleType.
I have 3different roles, 2 of which have sub-roles.
Example
Role----------------------Type
Adminstrator
Subscriber---Basic
Subscriber---Business
I need to implement Code Access Security, and URL based security using the roles & types...
For instance, the (Subscriber/Basic) would need to view a different set of pages, and have different access to things then a (Subscriber/Business).
I think I can handle the Code Access security with a custom attribute, but I am unsure to how enforce a User be apart of 2 roles in the URL Authorization.
I am currently using the web.config to deny/allow access to the directories/pages.
e.g.
/Areas/Admin/web.config
[Code]....
Is it possible to force the user to be apart of 2 roles with this technique?
View 1 Replies
Apr 16, 2010
my application is running under asp.net 2.0 and in iis 5.0 (Windows XP) in my machine.config, i have the following setting
[code]...
whenever i go to my default.aspx page, it seems it doesn't redirect to login.aspx.
View 5 Replies
Feb 25, 2010
This might be confusing but ill try to explain the best as i can. I have a gridview that get the data from datatable. This is simulation my grid view.
key data
1 data1
2 data2
2. data2
2. data2
3. data3
3. data3
what i want is make some conditional statement, when value "key" is changed i want to add empty row. so its suppose to be looks like this as result.
key data
1 data1
EMPTY ROW
2 data2
2. data2
2. data2
EMPTY ROW
3. data3
3. data3
View 2 Replies
Jan 7, 2010
I have used .net login control to authenticate user,i have three types of role ,role1,role2 and role3 and i have users and user have different roles.
now my requirement is like as per loggedin user i want to redirect user on particular page as per role.
for example if loggedin user role is role1 than he will redirect default1.aspx
for example if loggedin user role is role2 than he will redirect default2.aspx
for example if loggedin user role is role3 than he will redirect default3.aspx
and one question if same user may be have more than one role than what should happen???
I got a solution for same than if we are used "loggingin" event than it would be possible but i had placed login control in login view anonymous template because as per my requirement i want that after successfull login user can't see login control on page.thats why i didn't get the login control event on code.
View 6 Replies
Mar 22, 2010
In our system now, we have a class of user and beneath each class, there's a type of user.
Is there a way to setup and use the ASP.Net role provider with this kind of setup?
View 2 Replies
Feb 20, 2010
i am new to asp.net, i am creating a small website for my college, in that.
Only the admin's can create other users...
Now while using the nw registration wizard, i hav to mention the role also in that page.
View 5 Replies
Jun 10, 2010
can any one tell how to create the roles in asp.net? when ever Admin creates the roles, there it self he should assing the pages,which pages should be open when ever perticular person enters in to the site. When ever Admin wants to assing the Roles,all pages appear in grid view with check box,if he checks that pages,he able to access other wise he couldnot access that page.
View 1 Replies
Aug 3, 2010
i want to create a webservice that reading from the user identity interacts with a db, where there are app names and group that can use that app, and gives to the user a list of operation that he can use.
My question is, is there any table in apsnetdb that does this association or i should create a costum table.
View 1 Replies
Mar 1, 2010
Pls explain the Membership Roles in MVC ASP.NET 3.5
View 1 Replies
Feb 27, 2011
I know how use Roles in Controller:
[Code]....
In this situation, any one who is not "admin" can'nt vist the "About.cshtml". But what if I want anonymous can see part of the "About.cshtml"?
[Code]....
I know code above is wrong, But how can implement my goal in Views
View 2 Replies
May 18, 2010
I have created 3 different folders (admin, user, viewer) in my site and each has a different template (masterPage). I created user and roles which are admins, users, and viewers. I assigned each role to a user in .Net administration Tool.
What I need to do is to allow each user to access his page only and deny access to others , except for the admin who can access all pages.
View 4 Replies
Oct 5, 2010
I'm trying to redirect users upon login based on their roles which were defined in the Administer website feature of asp.net.Heres what I'm trying protected void Login1_LoggedIn(object sender, EventArgs e)
View 2 Replies
Oct 7, 2010
Im trying to redirect different roles to different pages. Its working but the code I'm entering allows people through even with incorrect passwords. protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
View 1 Replies
Jan 11, 2010
Im now in assigning a roles to a user. But, 1 of my user wants me to assign 2 roles for him.. The situasion is like this :
I have a few roles which are :
- zone head
-zone officer
-clerk
The problem is now 1 person can be assign for 1 role only..
How can i assign 2 roles for 1 user..
View 4 Replies
Jul 2, 2010
I'm workin with Visual studio 2010 and I'm trying to create an ASP.net Web Site, language used - C#
I have 2 different pages, for 2 different users with 2 different roles.Each page has a textbox.I have already created them.What I want to do, is to make a bind between this 2 textboxes, so that the second to get the first boxes' text.I managed to do it, but only if the textboxes are on the same page, very easy (Textbox2.Text=TextBox1.Text) . But how to do it for 2 different pages, for 2 different users with 2 different roles?
Another trouble would be....How can I connect the both users same time....after i start debugging the project, I do a sign in but when I sign in with the second user,the first is automaticly siggned out and the text it's lost.Then, how can they synchronize and the second user see what the first one wrote,using that 2 textboxes? Wich is the solution?
View 4 Replies
Jan 10, 2011
I have three roles:
AdminEditorGeneral
How can i give acces so to:
1- All users in roles Admin and Editor
2- Specific users from role General
i tried this but with no luck:
[Code]....
View 2 Replies
Aug 24, 2010
I have setup ASP security in my application. I used the following tutorial, just wondering if someone can tell me how i can setup this up to allow the creation of a user?
http://weblogs.asp.net/scottgu/pages/Recipe_3A00_-Implementing-Role_2D00_Based-Security-with-ASP.NET-2.0-using-Windows-Authentication-and-SQL-Server.aspx
where to find or what to search on to find some example of how to add the option for adding users?
I have the above setup and its working, but only because of the accounts i created with my global.asax file.
I need to give the admins access to add a new user. Currently i can search on existing users and update them, but need to add the ability to add a new user.
View 4 Replies