Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

Membership Class Annoyances or am I just ignorant?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Lozzi - 23 Jul 2007 21:50 GMT
Howdy,

My biggest annoyance with the membership class is that i cannot seem to get
to it in my master files. I'd like to setup my master file to check for
whether or not the current user is logged in or not, and if they are not,
send them over to the login page. But I cannot access the membership class
in a master page. I've done some reading up on this and some people have
suggested using a session variable to store a flag to indicate whether or
not the user is logged in. I tried that but it appears the membership class
expires sooner than the session does. Any ideas?

Thanks,

David Lozzi
Mark Fitzpatrick - 24 Jul 2007 00:09 GMT
Why not let the memberhsip system do this? If their cookie expires, then the
membership system should automatically send them over to the login page you
specify.

The easiest way is just to test Page.User.Identity.IsAuthenticated to see if
it's true.

It sounds as if something isn't configured correctly as the system should be
automatically handling all this for you. The entire point of the membership
system is to not use session variables, those are old classic asp principals
and aren't needed in ASP.Net 2.0.

Signature

Hope this helps,
Mark Fitzpatrick
Microsoft FrontPage MVP 199?-2006. 2007 and beyond

> Howdy,
>
[quoted text clipped - 10 lines]
>
> David Lozzi
David Lozzi - 26 Jul 2007 14:51 GMT
I'm assuming the configuration is handled in the web.config file. Can you
give me a sample of correctly configuring the membership class and I'm
assuming the Forms authentication as well?

Thanks,

David Lozzi

> Why not let the memberhsip system do this? If their cookie expires, then
> the membership system should automatically send them over to the login
[quoted text clipped - 22 lines]
>>
>> David Lozzi
Brandon Gano - 24 Jul 2007 00:11 GMT
All objects (Membership, Page, etc.) are re-created on every page
load/postback. However, anything you save in the Session object will be
re-created for each request.

If you are saving the logged in status to the session correctly, you should
be able to retrieve it later.

That said, there is probably a better way to do what you are wanting. Have
you looked into the built-in membership features as far as automatically
re-directing unauthenticated users?

> Howdy,
>
[quoted text clipped - 10 lines]
>
> David Lozzi
Kevin Spencer - 24 Jul 2007 12:47 GMT
The System.Web.Security.Membership class is a static class with static
methods. In other words, you can get to it from any point in your code, as
long as the namespace is resolved. However, when you say "I cannot access
the membership class" you are not describing anything that helps diagnose
what problem you're having. What exactly are you doing to "access" the
class, and what is the result/behavior/exception that you are experiencing?

Signature

HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

> Howdy,
>
[quoted text clipped - 10 lines]
>
> David Lozzi

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.