Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Membership Class Annoyances or am I just ignorant?

Reply
Thread Tools

Membership Class Annoyances or am I just ignorant?

 
 
David Lozzi
Guest
Posts: n/a
 
      07-23-2007
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

 
Reply With Quote
 
 
 
 
Mark Fitzpatrick
Guest
Posts: n/a
 
      07-23-2007
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.


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

"David Lozzi" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
 
Brandon Gano
Guest
Posts: n/a
 
      07-23-2007
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?


"David Lozzi" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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


 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      07-24-2007
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?

--
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

"David Lozzi" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
David Lozzi
Guest
Posts: n/a
 
      07-26-2007
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

"Mark Fitzpatrick" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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.
>
>
> --
> Hope this helps,
> Mark Fitzpatrick
> Microsoft FrontPage MVP 199?-2006. 2007 and beyond
>
> "David Lozzi" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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

>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cpl VS.NET annoyances JV ASP .Net 0 05-31-2005 09:05 PM
2 small annoyances RAH Computer Support 1 10-29-2004 01:11 AM
Windows Media Annoyances rnd Computer Support 1 04-08-2004 05:59 PM
A Couple of XP Annoyances Sam Computer Support 2 02-12-2004 02:05 PM
Canon: annoyances of a defective product & service policy John Faughnan Digital Photography 1 08-08-2003 11:19 PM



Advertisments