Solved

Prevent webpage access using forms authentication

Posted on 2012-03-20
2
233 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
Comment Utility
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
Comment Utility
Both solution worked fine indeed. I prefer the second.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now