User Restrictions On Views Based On Customer User Properties?
Feb 24, 2011
I'm using ASP.NET MVC 3.I would like to create an action filter to determine if a user can access a view. I have a User class with properties like IsAdministrator, IsTrusteeUser and IsAuditUser. How would I create an action filter to block certain users if the don't belong in some of these roles?And aslo how would I use this in my views to hide/display certain controls?
View 2 Replies
Similar Messages:
Feb 23, 2011
I am using ASP.NET MVC 3. We assign roles to certain people at work, then we use Windows authentication to determine what roles a user has. Lets say the roles are RoleA, RoleB and RoleC. So now I get a list of roles for a user. Lets says that UserA belongs to RoleA and RoleB. Some of my views need to be authenticated as not everyone can view certain views. Lets say that ViewA can only be viewed by users that belong to roles RoleA and RoleB. How would I do this? What would I need to look into? When a user that does not belong to these roles tries to access the views then he/she should be redirected to an error page.
View 1 Replies
Feb 24, 2011
I'm trying to allow logged user who are in department XYZ to perform some task for my third party App. I have two SQL tables named Users & UserList. The third party app (GoldMine) graps the USERNAME from the Users table and store it as UserID which I then referecnce SessionID. The UserList table has two columns (GM_UserName & Department) which I'm interested in. When a user login into the 3rd party app (GoldMine), i then compare the USERNAME (from Users table) to GM_UserName (from UserList table) and see whether GM_UserName is in = 'Dept XYZ'. Take a look at the SQL query below.
sqlDept = "SELECT USERNAME FROM Users LEFT JOIN UserList ON UserList.GM_UserName=Users.UserName WHERE UserList.Department ='Dept XYZ'"
I'm able to do this.
If Session("Userid") = "TestUser1" Or Session("UserID") = "TestUser2" Then Do this Else Do that End If
BUT unable to do this...
If user's Department = 'Department XYZ' Then
Do This
Else
Do that
End IF
View 2 Replies
May 9, 2010
I want to display a menu (which will be strongly typed with it's own unique model) across all pages only if a user is logged in.What menu items are available depend on the user's role and also I'll need to hit the repository to get numbers like "x Messages", etc
Been scratching my head for a simple solution here. Don't want to create something that need changes all over the place.All my controllers derive from a BaseController, all my Models from BaseViewModel....probably where I'll be implementing functionality for this.
View 3 Replies
Jun 6, 2013
I have table called ROLE with fields (id,name,permission) example values (1001,madhu,hr)
I have another table called LOGIN with fields(id,DOB,password) example values(1001,24101989,madhukumar)
What i want is , if i login using the LOGIN table ,it check the id and permission in the ROLE table , if the permission is 'hr' it enable to access the menu , or if the permission is any other it just print the error message ("no permission")
Note: menu is placed in master page , but login is not in the master page ...
View 1 Replies
May 7, 2015
I have LOGIN PANEL for student, and I want to disable it in different page. And only the admin can enable and disable it. I dont know the logic behind here.
View 1 Replies
Apr 27, 2016
I want to upload audio file based on the ID which i choose
For ex: I have three ID's in drop downlist, say
ID #1: 1001
ID #2: 1002
ID #3: 1003
I want to upload audio file for 1001. Later, On the same id i may upload another file also.
Then, If i choose 1001, the list of files that has been uploaded on 1001 sholud be displayed with download option in Gridview.
For SQL SERVER 2008.
View 1 Replies
Jan 3, 2011
In an ASP.NET page I have added two user control with a dropdownlist each one. The selection of a dropdownlist should be changed the query to the second user control.What is the most efficient way to pass the selected value of dropdownlist to the second?I initially thought of creating a public event (public string OnClientSelectedIndexChanged) while the first user control and outsource through a public string SelectedValue the selected value of the second user control:
public string SelectedValue
{
get
{
[code]...
View 2 Replies
Jul 19, 2010
I am new to asp development but have been around c# for a while. Basically I am trying to create a page which will pull data from a database and then for each object it creates I would like to add a user control which is built to represent that object. So basically I have tried quite a number of things to get it to work but for some reason I can't figure it out! How can I programmably add user controls and then set their properties from a 'master' page which hosts the user controls?
View 3 Replies
Nov 9, 2010
I want to use a couple of instances of the same control on a page. The user control is intended to display a list of records in a repeater. The aim is that the second control will show a list excluding the IDs in the first control The control has a number of public properties, including IDsInThisList, and IDstoExclude. The query will exclude the IDs in the second property.
What I would like to do is get the record IDs from the first instance of the control (IDsInThisList), and pass them to the second contro as the IDsToExclude.
I have a test page where I am setting the properties of the controls in code. As you might guess, it's not working! The first control displays the top 3 items, as desired, but the second display the records 1-7, rather than records 4-10 because it is not receiving the IDstoExclude from the first control When I response write the IDstoExclude from the first control in my testpage, the string is empty. (if I do it from within the control, it shows the IDs)
How can I get the controls to fire in order and pass values to each other?
Screen grab of test page + uc and test page code attached
[Code]....
View 5 Replies
Jun 26, 2010
i am working in asp.net and csharp, we have 10 user, but certain user only need to put dataentry. how to enable and disable based on the user to access certain form ,like add, modify view options.
View 1 Replies
Apr 8, 2010
I am trying to count page views for each user.
After 100 views, the user won't able see the page anymore.
At the end of the dat the counter will be reset.
I think of using the cookies, but it is very easy to hack.
How do I manage this the best way and reset every 24 hours the counter?
View 4 Replies
Jul 21, 2010
I have users that belong to more than one role and I have a login view for those roles but I only see the first role's content.
How should I be going about getting to see all content for the roles that user is in? My user logs in and is a member of MACED and ADMIN but only sees the links for MACED
[Code]....
View 3 Replies
Feb 3, 2011
I am using a MultiView control inside a FormView to break my form into more manageable sections for the end-user. I am trying to make it so that each time the Next button is clicked, the entire form is validated and a list of the fields that have not yet been completed show up in the Validation Summary.
I would like my users to be able to continue through the MultiView 'wizard' even if they haven't completed all the fields -- they should be able to come back to them later. But I would like the ValidationSummary to display the fields they've not completed that are required as a reminder of what to come back to if possible.
I've tried playing around with Page.IsValid with no success.
[Code]....
The code-behind for the Next button is as follows:
[Code]....
View 3 Replies
Mar 2, 2011
This form has some information for making a reservation for a customer at a dining venue. If the customer is a "known" / "returning" customer id like to fill the form based on the customer ID. Some of the things on the form are ...
textbox=CustomerID
Input Button
textbox=FirstName
textbox=Lastnemt
Using MVC, What would be the best way to go about going back to the server to find the customers first / last name and posting it back to the values in the textboxes ? Ive been trying to work with AJAX & JQuery but i cant seem to update the values in the textbox using AJAX.
View 2 Replies
Nov 29, 2010
I'd like to add some custom instance properties to an ASP.Net User object. for example, I'd like to log every user's login and have something like: User.LoginTimes or calculate the User Profile's Completion percentage and be able to access it like: User.ProfileInfoPercentage, etc.
Now What I'd like to know is what would be the best approach to do this?
Forget about user instances? (e.g. define a database table with userid and ProfilePercentage info and retrieve data from profile like: DB.GetProfilePercentage(Context.Current.User.UserID) )
Override the ASP.Net User class and add my own functionalities.
Use Extension methods for the user class.
View 1 Replies
Jan 11, 2011
I have a very simple user control in my web site project which has public property declarations as following
[code].....
When i drag the ascx file to one of my aspx page and when i go to code behind of aspx page i can access the controls properties through intelisense, but when i run the project through visual studio i get error "The name 'uctTest1' does not exist in the current context?
This is the line where Error shows when i run the project uctTest.StartDate = DateTime.Now;
aspx page markup :
[code]....
View 3 Replies
Jul 16, 2010
I am using a custom membership provider. I want to expose additional properties under User class.
So in my custom membership provider class I added few Properties (FirstName, LastName, Address, etc) and set their value in ValidateUser(). However back in aspx.cs if I type User. I do not see FirstName, LastName and Address in intellisense.
Is what I'm attempting to do even possible? Or do I need to resort to using my own custom user class? In which case I wouldn't need to use custom membership provider because I can program my custom user class to do everything that custom membership provider can do. Only thing is I would need to pass this user object in session object.
View 3 Replies
May 15, 2010
i have a multiple user controls, each user control has multiple properties, i am loading those controls dynamically in my aspx page,i save the user control name in a hidden field in my aspx page,so i can know whats usercontrol are currently loaded,now i want to set/get some values for Currently user control properties,how can i know the properies available for that dynamics loads control ?also how to know the class for that control ?
View 3 Replies
Dec 1, 2010
I'm creating a web user control in asp.net using C# in which i can select a date from a calendar and display it in a textbox. when i select a date from the calender it has to be displayed in the textbox. now i need to set my own properties by which i can select datetime patterns in cs codefile. for example
usercontrol1.dd-mm-yyyy.
this is one example. now i want all the datetime patterns of "en-us". when i use that usercontrol in another page i want to set any of the properties(datetime patterns) to that control.
public partial class DateControl : System.Web.UI.UserControl
{
string dateformat;
public string Dateformat
{
[Code].....
i said that i want set properties for my user control and create events for that..
View 1 Replies
Mar 11, 2011
How to access userControl's properties, when use FindControl method?
View 7 Replies
Jan 21, 2010
I have put a user control on my default page. The user control contains a label and a textbox. When I am trying to access the user control from the default page in the codebehind it says
Object reference not set to an instance of an object. I am wanting to do something like this:
View 7 Replies
Feb 2, 2011
I have built a user control that has a public property string[] foo.
Is it possible to assign this in the actual markup?
The type of project is ASP.NET webforms / web application.
Ive tried the following syntax, but it doesnt work: (It compiles but the value is never assigned).
<abc:MyControl runat="server" foo='<%# new string[]{"Hello"} %>' />
View 3 Replies
Mar 19, 2010
I want to use Profile Properties to keep some user information and move them between pages. I'm wondering if those profile properties are keeping data session based or when I assigned them is it same for all sessions/ Is this a safe method to use them:
<anonymousIdentification enabled="true"/>
<profile enabled="true">
<properties>
<add name="userid" defaultValue="" />
<add name="password" defaultValue="" />
<add name="username" defaultValue="" />
</properties>
</profile>
View 1 Replies
Jul 7, 2010
I am using the Membership provider that is included in Framework 3.5. I need to be able to add properties to the user such as country and birth date. I have read about the alternative provider that microsoft distibutes called TableProvider where you can define extra properties in the webconfig. I hesitate a bit about using it as there where some stuff about adding rules to the database to allow access. Since i use a hosted server and i am almost clueless about database administration it got me enough worried to think out my own solution. A. any feedback about using table provider from people that have experience of it?
View 4 Replies