Checking Session value

T

tofu.captain

I have a bunch of administrative ASPX pages that requires me to check
for a Session value. I have a Masterpage.master file that all these
ASPX pages use, that checks this. The problem is that the codebehind
for each of those ASPX pages runs before the codebehind in the
Masterpage file.

I run my check in the Masterpage as:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["foo"] != null)
// Load page
else
Response.Redirect("Login.aspx");
}

Each of those ASPX pages uses the Session value. Is my only option to
put the Session check in each of the ASPX pages instead of the
Masterpage file?
 
B

bruce barker

you could just use the builtin authentication code in asp.net. turn on
web authentication, set the admin pages as requiring authentication and
you're done.

-- bruce (sqlwork.com)
 

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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top