asp.net 2.0 design login area case study

I

info.lowyeah

Dear all,

I have an ASP.NET 2.0 website design problem.

I want to design a website, there are few normal pages(page1, page2,
page3) is to show my information. But there is another login
page(page4), which is used to allow advanced user to login and show
advanced page(page5,page6)

My problem is that when unauthorized user go to my main page, they no
need to go to login area to login.
But due to the web.config authorization setting, users cannot go to
all pages.
So, I add the following code
<location path="page1.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>

But I found when I add one normal page, I need to add one set of the
above code in web.config. So I feel quite annoy.

Is there any good method to simply the above process?
For example, if I have 30 normal page (no need to authorized) and 3
advanced page (need to authorized), I need to add 30 <location></
location> tag to web.config.

Can anybody help me to solve this problem?

Regards and many thanks
 
N

nick chan

i never played with web.config authorization thing before
my projects are similar to yours

I use inheritance

example

CBasePageX.vb CBasePageZ.vb

these 2 classes will inherit System.Web.UI.Page

in CBasePageX page_init, U check for Session("loginid1")
in CBasePageZ page_init, U check for Session("loginid2")


so u can let page1,2,3 inherit CBasePageX, and page4,5,6 inherit
CBasePageZ

if i login LoginX.aspx sucessfully, i put loginid in
Session("loginid1")
same thing for LoginZ.aspx and Session("loginid2")

so whenever I create a new page that needs different kinds of logins,
i just inherits on the CBasePage classes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top