Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I setup new web pages to require authentication?

Posted on 2011-09-23
5
Medium Priority
?
195 Views
Last Modified: 2012-05-12
Hi, I'm using asp.net and C# 3.5.  
I created an asp.net web application that requires membership authentication through login screen.  There was only one page after use is authenticated in.  I now need to create several pages and they all should only allow access after the user is authenticated.  However, I forgot how I set that up.  Can someone tell me in quick steps on how to do this for the new pages?  Thank you.
0
Comment
Question by:lapucca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:disrupt
ID: 36591195
0
 
LVL 4

Accepted Solution

by:
guramrit earned 2000 total points
ID: 36591313
You can use web.config to implement this type of security.
You can do it in two ways.
1. Folder level
2. File level

I guess, you need file level security. To implement this, see following code, it's added in web.config

 
<location path="AddStatusReport.aspx">
	<system.web>
		<authorization>
			<deny users="?" />
			<allow users="*" />
		</authorization>
	</system.web>
</location>
<location path="EmployeeRatingReport.aspx">
	<system.web>
		<authorization>
			<allow roles="Administrators" />
			<deny users="*" />
		</authorization>
	</system.web>
</location>
<location path="DailyStatusReport.aspx">
	<system.web>
		<authorization>
			<allow roles="TeamLeads" />
			<deny users="*" />
		</authorization>
	</system.web>
</location>

Open in new window


add this code before closing tag of <configuration> ie. at the end of file. and modify page names according to yours.

? : anonymous users
* : all users

for more details, see : Setting authorization rules for a particular page or folder in web.config
0
 

Author Closing Comment

by:lapucca
ID: 36597262
remember now.   I put a web.config for my Admin folder.  Thanks.
0
 
LVL 16

Expert Comment

by:disrupt
ID: 36597495
Did you look at the link I gave? Showed how to setup the web.config...
0
 

Author Comment

by:lapucca
ID: 36597552
sorry but I didn't see your posting but now I look at the link it's not really what I need  I would have give you some points if I saw the link but sorry i missed it.  Gu's link gave more examples and is what I need.  A web.config for the folder.  Thank you.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

618 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