Solved

Prevent webpage access using forms authentication

Posted on 2012-03-20
2
247 Views
Last Modified: 2012-03-21
Dear experts,

I have used the following two articles to setup forms security with roles.

http://support.microsoft.com/kb/301240
http://support.microsoft.com/kb/311495

Now I can use the roles to access or not give access, but I am wondering how to do this best.

I can show or hide menu items bases on the role, but a user can then still access pages if he/she manual enters the url manually. What is the best approach to prevent users from accessing a webpage?

Best regards,
MB
0
Comment
Question by:mark_norge
2 Comments
 
LVL 7

Accepted Solution

by:
markmiddlemist earned 500 total points
ID: 37741103
There are 2 ways you can do this:

1 - In Code - In your page load handler include the line:

if (Roles.IsUserInRole("RoleName")) then
  Response.Redirect("/")
end if

or, the easier way is to use your web.config file - http://www.codeproject.com/Articles/2905/Role-based-Security-with-Forms-Authentication
0
 

Author Closing Comment

by:mark_norge
ID: 37746108
Both solution worked fine indeed. I prefer the second.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question