473,487 Members | 2,674 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MemberShip, User, Roles.. is there a smarter way?

I am currently using the built in membership functionality with
asp.net 2.0. I currently have set the web.config to only store
registered users in the database. I don't want to polute the
aspnet_Users with anonymous users.

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.

Please let me know.

Thanks

Jul 14 '07 #1
1 1801
To me, I will normally use session state. That will be more independent for
whether the Membership is used.

Ming Man

"Nightcrawler" <th************@gmail.comwrote in message
news:11**********************@o61g2000hsh.googlegr oups.com...
>I am currently using the built in membership functionality with
asp.net 2.0. I currently have set the web.config to only store
registered users in the database. I don't want to polute the
aspnet_Users with anonymous users.

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.

Please let me know.

Thanks

Jul 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1374
by: artificer | last post by:
I want to create an Internet application that will be accessed by several pre-registered companies. All of those companies will be accessing the same database and the same application but each one...
5
1648
by: JP.Gantlin | last post by:
I want to have a login page where the new user self-registers, giving some simple info like Real Estate Agent #. Do I need to used the membershiop/roles thing, or profiles? Are profiles part...
5
1549
by: Coder | last post by:
I am not sure if I should use the new membership and roles feature in ASP.NET 2.0. My user information is large, and does not fit in the default implementation tables. I don't know if it is worth...
4
3249
by: AC | last post by:
Hi there. My asp.net 2.0 development website uses roles to control access to sections of my site, configured using the asp.net configuration tool, which is great. Except that isn't available once...
5
2895
by: Mahernoz | last post by:
Hi Everyone! I have a problem here. I have used the latest asp.net membership & profiles functionality in my site. I have 2 roles admin and user. I also have a user named admin. Now, my...
3
2165
by: Glenn | last post by:
My current classic-ASP site has users, projects, roles and the 2.0 membership looks like a perfect fit, but I'm having trouble finding examples of how to have users that belong to different...
4
8207
by: alexandis | last post by:
There are tons of articles about custom role and provider membership, but they just tear me apart and confuse :( The situation is following: I use DB2, so I wrote custom role + membership...
6
2913
by: Jonathan Wood | last post by:
Although this will be a challenge at my level of ASP.NET knowledge, I'm thinking I should implement my own membership provider class. Looking over the methods I must implement, a number of...
3
1773
by: dm3281 | last post by:
Hello -- I need to write an ASP.NET 2.0 application for our clients to use to login and verify file transmissions. Each client will need their own logon, in addition to a way to assign each...
0
7106
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7349
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4874
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
267
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.