N
Nightcrawler
I recently started to use MemberShip, Roles, and User to build a
portal site in asp.net 2.0. I currently have set the web.config to
only store registered users in the database. I don't want to pollute
the aspnet_Users with anonymous users.
I have two questions:
1. When a user gets to one of my aspx pages I would like to find out
if the user is logged in. I am currently doing it this way:
MembershipUser membershipUser = Membership.GetUser();
if (membershipUser != null)
{
... some code
}
else
{
... some code
}
Is there a better way? I feel that everytime I do this it will have to
pull the user from the database. It sounds like an expensive way to
see if the user is logged in or not. Does the built in membership/
roles engine in asp.net 2.0 support storing this information in a
cookie? What is the most efficient way available?
2. My website contains a profile page that any logged in user can see
using LoginView. However, I want to find out if the user viewing the
profile is the same user that created the profile and offer a couple
of extra buttons. Is there a clean and resource efficient way of doing
this?
Thanks in advance.
portal site in asp.net 2.0. I currently have set the web.config to
only store registered users in the database. I don't want to pollute
the aspnet_Users with anonymous users.
I have two questions:
1. When a user gets to one of my aspx pages I would like to find out
if the user is logged in. I am currently doing it this way:
MembershipUser membershipUser = Membership.GetUser();
if (membershipUser != null)
{
... some code
}
else
{
... some code
}
Is there a better way? I feel that everytime I do this it will have to
pull the user from the database. It sounds like an expensive way to
see if the user is logged in or not. Does the built in membership/
roles engine in asp.net 2.0 support storing this information in a
cookie? What is the most efficient way available?
2. My website contains a profile page that any logged in user can see
using LoginView. However, I want to find out if the user viewing the
profile is the same user that created the profile and offer a couple
of extra buttons. Is there a clean and resource efficient way of doing
this?
Thanks in advance.