.NET custom security: still possible?

P

plugwalsh

Hi

I'm new to ASP.NET (from classic ASP) and wasn't aware of the Forms
Authentication security when I started working on a website. So I
built a login page that stores a CustomUser object in the Session, and
then I put a login check in the Master Page codebehind, Page_Load
event, which redirects to the Login.aspx if the login check fails.

I realise NOW that I should have gone th Forms Authentication (using
web.config) route, but I dont have the time to change this now - I
have to deliver the website today. I can come back later and change
this.

So FOR THE TIME BEING, how can I get my custom security system to
work?

The problem is, I have just put some code that uses the Sessions
CustomUser object - into the Page_Load event on one of my access-
restricted pages. But now I see that the Page_Load event of the
content page fires BEFORE the Master page login check. I tried moving
the login check to the Init event of the Master Page, but the content
page's Page_Load event still got executed.

So I guess what I'm asking is, how do I (and where do I) add code that
can check a Session object, and can then redirect the user WITHOUT
executing the rest of the Page_Load (or any other such events)?

Much appreciated.
Sean
 

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

Top