After Form Authentication: IsAuthenticated and User Name

  • Thread starter Thread starter Johnnie Norsworthy
  • Start date Start date
J

Johnnie Norsworthy

ASP.NET 2.0

I can't seem to locate how to determine two simple things after I perform a
FormAuthentication.

From a subsequent page load, how do I determine if a user is authenticated
already?

If they are authenticated, what property do I read to find out their name?

Thanks - I looked all over the help file and a bunch of web sites, but I
could not find an answer to this for some reason.

-Johnnie
 
From a subsequent page load, how do I determine if a user is authenticated already?

You don't need to, it's handled automatically, of course you may want to do it
anyway in case the site is missconfigured accidently.

You can use Request.IsAuthenticated to check if the user is authenticated.
If they are authenticated, what property do I read to find out their name?

Page.User.Identity.Name

PL:
 
PL said:
You don't need to, it's handled automatically, of course you may want to
do it
anyway in case the site is missconfigured accidently.

You can use Request.IsAuthenticated to check if the user is authenticated.


Page.User.Identity.Name

Thanks. I'll give that a go.
 

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

Back
Top