Forms authentication puzzle

B

branton ellerbee

How do you implement a login control across multiple .aspx pages that allows
access to pages and directories with the application you are designing?

For example, imagine a login control that is located on everypage you go to
until you have logged into the application. Once you have logged in, then
the control goes away and maybe replaced with a list of options that
enables you to do whatever no that your credentials have been varified.

I know how to implement Forms authentication but that is virtual directory
specific. This is more, site specific. Once your credentials are validated,
then you are free to use other parts of an application, etc.

How do you do this with .aspx... It is pretty simple with asp...
 
K

Ken Dopierala Jr.

Hi,

It is really simple with ASP.Net too. For many of my sites I have a little
cell. All of my pages inherit from a page control that I created by
inheriting from System.Web.UI.Page. In the load event of my base page I
check if the user is logged in or not. If they are I place a user control
in the cell that displays specials and what not. If they are not logged in
then I display a user control that lets them log in.

Note that in ASP.Net just like in old ASP, if you are planning this ahead of
time it is a breeze. If you are at the end of the project then it will take
some work. The cool thing is that at the end of the project this is much
easier to implement in ASP.Net than in ASP. Good luck! Ken.

P.S. One of the cool things about using Roles with Forms Authentication is
it lets you do even further customization in that cell. For example Admins
get to see how many users are currently on the web page, Sales Managers can
see how many sales have gone through in the last 24 hours, and so on.
 
G

Guest

Hi,

You said in this reply "All of my pages inherit from a page control that I
created by inheriting from System.Web.UI.Page"

Do you use Visual Studio? When I tried to do this (build my own page
control, inheritiing from weg.ui.page) VS wouoldn't process any pages that
inherited from my control.
It could only handle pages that inherited from web.ui.page (VS2003)

Did you have any problems? If so, how did you solve them?

Thanks,
David
 
K

Ken Dopierala Jr.

Hi David,

Instead of posting a bunch of possibilities I thought I would post a link to
a neat article that really goes in depth on the subject:

http://www.devx.com/dotnet/Article/18011

Give that a try. If you have any questions with implementing it just post
them to the group and reference that article. By doing it this way we'll
have a similiar perspective of the code you are using.

Also, this is a good link for C# that has a completely built project you can
download and run:

http://www.codeproject.com/aspnet/page_templates.asp

Good luck! Ken.
 

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top