Controlling user roles to access different page without using Web.Config

i have an application where all my user roles is actually been define inside the database.Is there anyway i can do in rather then putting the user web control into every pages like in the classic asp?

7/25/2005 1:43:49 AM 27051 articles. 1 followers. Follow

8 Replies

Similar Articles

[PageSpeed] 58

Role-Based Authorization With Forms Authentication.
Check this post (mine:) and in the page_load use:

If User.Identity.IsAuthenticated Then
    If User.IsInRole("Role1") Then
        ' Do something
       ' Do nothing
    End If
    ' Default ... or. ...
End If

It helps?


“If something can go wrong, it will”
7/25/2005 9:46:50 AM

let says i have 10 different aspx page and i have to put this code into all the pages? any other suggestion? i am thinking of using the Global.asax Application_AuthenticateRequest?
Any idea?

I wanna prevent certain roles to access to my pages.
For example Page1.aspx can be access by Role1. And if Role2 tries to access to Page1, i will need to kick him out to login page. The question is which is the best way to do it without slow down my application.
The Role1 and Role2 is actually determine by my database:
RoleID   RoleName   Page
1            Role1             Page1.aspx
2            Role2             Page2.aspx

Please advise.

7/26/2005 8:58:47 AM
 dorris wrote:

let says i have 10 different aspx page and i have to put this code into all the pages? any other suggestion? i am thinking of using the Global.asax Application_AuthenticateRequest?
Any idea?

  1. You didn't want to use the web.config
  2. You looked to the link I gave you? I use the Application_AuthenticateRequest...
This is an excellent tutorial!

Why you have your pages( / pagenames) in the database?


“If something can go wrong, it will”
7/26/2005 9:30:15 AM
by doing pagerequest will have performance issue because it will fire off each time the page request is it?? 
i am thinking if doing in my base class where it's not page.ispostback....
i m having my pagename inside my database u ask? reason is becoz u m drawing/randering my page link based on whatever in my database so in the future i have new function or i should say a new pages, i just add into the database n control the user right without have to open up my mainpage n hardcode the page hyperlink...

^_^ thanks for ur idea ..i am still looking for other alternatives ^_^

7/26/2005 3:01:41 PM
 dorris wrote:
by doing pagerequest will have performance issue because it will fire off each time the page request is it??

The Onauthenticate_request is fired everytime, always! (With the page_prerender it is the same and you don't complain about that aswell...Wink [;)])
You just have to take care, you call the database only once... and I'm not going to tell you how Stick out tongue [:P] Wink [;)]
It's not because I had to find out myself, but I already gave you the code... insert, debug and watch!

Or I misunderstood you, but I don't think that...

“If something can go wrong, it will”
7/26/2005 6:17:26 PM
well for page_prerender if u remover the delegate in ur code design, it shouldnt fire it :p
Anyway.. thanks i got what you mean ^_^

7/27/2005 5:32:29 AM
Hi Eriksk,

I went through your coding Detecting session time out. Can you explain about it since Im new to .Net? And is AccountSystem in the coding used only in Asp 2.0? Coz when I used in my coding it was showing error. Or do I have to import a namespace for it? Where do I put the coding for getting the values from database. In web.config using Appsettings I connect to database. Somewhere in the coding do I have to insert the coding? Sorry to disturb you but I would like to learn more.

8/1/2005 5:09:24 AM
Sorry I locked the last msg in mistake. Im still waiting to learn about the coding Eriksk. Or you can post it to my mail directly.
8/4/2005 6:31:22 AM

Similar Artilces:

Howto Show the user which roles has access to a certain page based on the roles assigned to that page in web.config?
Hi!I have started to build a website which will be using Formsauthentication through the ActiveDirectoryMembershipProvider. For Roles I´m using the AuthorizationStoreRoleProvider for Roleauthorization against Active Directory. If the user isn´t authorized to access a page because he/she does not belong to a certain role/roles specified in web.config, than the user is redirected to the login page. Now my question. Is it possible, at the login page, to programmticly check which role/roles the user had to be in to be able to see the page requested and show this roles for the user? So that ...

Web page is slow to load, using several different web user controls?
I have a web form that uses three user controls. When the page loads it is so slow, taking several seconds to load the other controls. Does anyone know how I might fix this? Here is the main .aspx page that has the controls.  <%@ Page language="c#" Codebehind="DocList.aspx.cs" AutoEventWireup="false" Inherits="DocumentMgmt.DocList" %> <%@ Register Src="Controls/DesktopPortalBanner.ascx" TagName="DesktopPortalBanner" TagPrefix="uc2" %> <%@ Register Src="Controls/DocMgmtStandard.ascx" TagPre...

Web user control used in different pages
Hi !I need some help with a web user control.I have two pages in my application "ImageInformation.ascx" and "RequeteInformation.ascx" and a web user control "MotInformation.ascx".I load this control in the two pages like this: _motInformation = (MotInformation)LoadControl("MotInformation.ascx");PlaceHolder placeHolder = new PlaceHolder();placeHolder.Controls.Add(_motInformation);The problem is that when the control is modified in one of them, it's also modified in the second and i don't want that. I try to put a different ID of the web user control when i load it in each page but it do...

access controls on web user control x from web user control Y
I have 2 web users controls in a page and I would like to get or set the selected values of a few dropdown boxes on web user control X from web user control Y and I also would like to know how to access functions that are on a web user control X from a web user control Y, is this possible? How can I do it? User can access and set the values of the User Control from .aspx page through properties,using javascript and in code-behind of aspx page.The details of it are shown below Using PropertiesIf the Sample.ascx control has two textboxes and submit button.You can access the valu...

Single page with multiple user web controls VS Multiple page with specific user web controls
I have a question regarding single page with multiple user web controls vs multiple page with specific user web controls   Option 1: I am of the opinion to have multiple pages with specific user web controls and use an object to store all the information as the user navigates through the application. And finally at the end, read this object and save all the information to the backend database.   Option 2: My respected team member suggests that we have only one page, with all the specific user web controls and not use an object, instead show/hide the user web controls based ...

I have a web user control being used by another web user control, but the one being used will not display the labels in the resx file.
I am using DotNetNuke version 3.13 (might be 3.013) on a Window's XP machine, SP2. I have what I find to be an extremely odd situation. I have a project called TDS.Controls. This project is a web control library. Each control has its own resx file, which is located in the App_LocalResources directory. Each control inherits from Framework.UserControlBase, just like DotNetNuke's User control in DNN\Controls\User.ascx.vb. As a matter of fact, this control is doing the exact same thing I am trying to do. It is a web user control with its own resx file being used by another web user control (See ...

Silent printing from a web page using .NET control; security error
I am trying to create an activeX object that would allow me to do silent printing from a web page (printing without the user pressing any button). I have created an ActiveX object (or the equivalent of it) in C# using a tutorial from It works great. I then added some code to it to test the printing functionality. Essentially, to test things, I have a web page with an <OBJECT> tag instantiating the ActiveX, which works fine. There's an HTML button that calls the Print() function when pressed. Right now, when I press it I get the following error (in javascript...

show each user pages which can access, without using membership or roles
 hi i have the following scenario:each employee authorized to just enter some pages in web site, as an example : jack can enter page 1 ,2 and 3 ,mary can enter page 1 and 3;i want each employee to see a treeview that show him/her the pages that can enter; what is the best way to implement this dynamic view, i mean, i want each employee when enter to see a treeview with pages that can access and i need to keep this tree view alife while he is logging on.HINT: i am not using neither membership nor roles in my web site, i have my own database to store users and to store pages which t...

How to deny access to non admin user to some pages using web.config file?
 hi,I am using Forms Based Authentication and web.config file.Right now, I have Admin type user, that can access all the pages of the website. But I am looking for a non admin type user that cannot access some pages, and when he tries to access, a page or message comes up like "you are not authorised to use this page".I have used very simple web.config file, and simple login. My login page code file reads like this:---     protected void Button1_Click1(object sender, EventArgs e) //It is the Submit button, e.g after entering username and password ...

Access data using web service from a Dot Net windows user control
Hi, I have a Windows Control Library and many UserControls in them. I added the output .DLL to another web project. I have put the dll in the root folder of the website. Now, in my .aspx pages I will declare <object> as follows. <object id="some id" name="some name" classid="some.dll#namespace.usercontrol name" width="578" height="404">    <param name="DAWebServiceUrl" value="<%=DAWebServiceUrl%>" /></object> This works fine if the url of the website has LOCALHOST. If I use t...

Using Registered Controls from Web User Controls as if a Page
If you look at the snippet below you will see that I have registered all these control sets to my pages so when in the design view I can type away happily and have access to my AjaxControls, Render Controls and Lang controls. Problem is Im using alot of Web User Controls, which when in the design view of the web User Controls, these same controls do not show up in the quick menu. which makes life a little more frustrating than it should be. How do I get these to work? -Hope that makes sense.<system.web><pages>               &...

How do you access controls within a web user control from another page?
Hi guys/girls. Say for instance you have a web user control with 2 textboxes in it - txtBoxFirstname and txtBoxSurname. I place this web user control on a page. How do I access those controls from that page? Thanks guys this.Findcontrol("UserControlName"); Hi,You can make two properties on the user control that will expose the Text property of the textboxes and then from the page you'll be able to use them.For example in the user control:public string Text1{   get   {       return Textbox1.Text;   }   s...

values of web controls in user control can not be access from other pages???
I have aspx page(brief code: includes ascx file) <%@ Register Src="reseller.ascx" TagName="reseller" TagPrefix="uc1" %> <form id="form1" runat="server"> <uc1:reseller ID="idreseller" runat="server" /> </form> the code for asxc file . i have the PostBackUrl to reseller.aspx <asp:TextBox ID="txtPostCode" runat="server" CssClass="form1" Width="50" MaxLength="4" /> <asp:ImageButton ID="ibtn"  ImageUrl="images/searchbutton.jpg" PostBackUrl="~/reseller.aspx" runat="server"  /> In my reseller page i try to read the post value of control txt...

How can I access a control on a master page from a user control using properties?
Hi, I have a master page which I'm using on my aspx page.  Within this aspx page is a user control and I would like to set a label on my master page using a value from my user control. I can do this using FindControl as shown below but I would like to use properties in my master page. The following code in my user control works perfectly: Label theFormName = (Label)this.Page.Master.FindControl("lblFormName");theFormName.Text = "My Test Form"; However I've been told that using properties is a much better ideas (errors would be picked up at compile time an...

Web resources about - Controlling user roles to access different page without using Web.Config -

Talk:Controlling for a variable - Wikipedia, the free encyclopedia
This article is within the scope of the WikiProject Statistics , a collaborative effort to improve the coverage of statistics on Wikipedia. If ...

Controlling What You Share on Timeline - Facebook
Facebook and Privacy hat eine Notiz mit dem Titel Controlling What You Share on Timeline geschrieben. Du kannst den vollständigen Text hier lesen. ...

Balloon Snake - Pop Balloons by Controlling a Bird with the Accelerometer or by Touching on the App Store ...
Get Balloon Snake - Pop Balloons by Controlling a Bird with the Accelerometer or by Touching on the App Store. See screenshots and ratings, and ...

Controlling a Computer with Eyes - Flickr - Photo Sharing!
Some folks know I work with assistive technology, and this shot is one from many I took in the last few days at a conference in Phoenix. This ...

Controlling Doepfer modular synth with a Wiimote - YouTube
This video is about controlling a modular synth with Nintendo's wiimote gamepad, using Doepfer A-100, Doepfer MCV24, Wiimote and computer. Softwares ...

Controlling the minds of cockroaches using Microsoft's Xbox Kinect
Late last year, you were introduced to real, live, remote-controlled cockroaches. Well, the insect hackers at the North Carolina State University ...

CONTROLLING CHAOS: Twitter's Wild Ride From Doodle To IPO
CONTROLLING CHAOS: Twitter's Wild Ride From Doodle To IPO Business Insider Australia “We apologise if the following profile lacks our usual ...

View from the Street: Power to the people controlling the power!
Your news of the day, reduced to a snarky rant.

Dying to be clean: The new technique for controlling feral cats
Cleanliness may be next to godliness unless you're a feral cat, in which case, cleanliness may get you a place next to god. In kitty heaven, ...

Passwords the key to controlling Heartbleed
Stronger passwords are required to avoid being stung by Heartbleed.

Resources last updated: 12/24/2015 3:48:08 PM