473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Question about Security

I'm going to be writing an asp.net application that certain users have
access to specific pages and others don't. User authorization will be
handled within the application via a login page. My question is, what is a
good approach to use to prevent certain users from accessing a page while
allowing others access?

As it stands, I'm planning to use a session variable to first make sure the
user has been logged into the system and second has access to the requested
page. If either case is false, the user would be redirected to the login
page.

Is there a better way to handle this in asp.net?

Nov 17 '05 #1
2 960
I would suggest to derive all your pages from a custom "BasePage" (that
itself is dervied from the standard Page class. Within this base class,
you could expose logic to test the user's security context that is being
tested in your web forms, eg

if (!HasPermission(CustomPermission.EditContent))
{
//show error or whatever
}
The granularity may be chosen depending on your needs:

protected bool IsAdmin();
protected bool HasPermission(CustomPermission permission);
protected bool IsInRole (CustomRole role);

HTH

Philipp


Jeff Cope wrote:
I'm going to be writing an asp.net application that certain users have
access to specific pages and others don't. User authorization will be
handled within the application via a login page. My question is, what is a
good approach to use to prevent certain users from accessing a page while
allowing others access?

As it stands, I'm planning to use a session variable to first make sure the
user has been logged into the system and second has access to the requested
page. If either case is false, the user would be redirected to the login
page.

Is there a better way to handle this in asp.net?


Nov 17 '05 #2
Thanks for your help.
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
1
by: Jeremy S. | last post by:
..NET's code Access Security enables administrators to restrict the types of things that a .NET application can do on a local computer. For example, a ..NET Windows Forms application can be...
6
by: Bri | last post by:
I've just started checking this out. I've got it to work alright with one exception. It is a secured MDE, so I've setup all the INI file options for it. The problem is that the UserID I setup for...
0
by: jobs | last post by:
Using the delivered login controls, I see there is something for passwordrecovery. But I can't seem to find how to set properties so it does not ask me for my security question. Is there any way...
2
by: Ken Fine | last post by:
I want to add the security question and answer security feature to the ChangePassword control. I am aware that this functionality is built into the PasswordRecovery tool. I have implemented the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.