Solved

Retrieving values after extending the Membership User class

Posted on 2007-11-30
4
573 Views
Last Modified: 2010-05-18
http://msdn2.microsoft.com/en-us/ms366730.aspx

In the above article, it tells how to extend the MembershipUser class with a custom provider...

It says:

"Additionally, you can extend the MembershipUser class to make the added user values available to application code."

In the above example, it is creating two new values:

        Private _IsSubscriber As Boolean
        Private _CustomerID As String

        Public Property IsSubscriber() As Boolean
        Public Property CustomerID() As String

My question is, from within a page page_load or other class or function....

How do I now access this new "IsSubscriber" variable?

If I type "membership." the intellisense doesn't kick in and add the new value to the list of choices? I must not be accessing it properly? I see the others there, but not the new ones. Please help.

thanks.
0
Comment
Question by:Starr Duskk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
anoyes earned 250 total points
ID: 20385194
I believe what you need to do is cast a variable as your custom user, so for example:

Dim u As CustomUser = Membership.GetUser(Page.User.Identity.Name)
Dim IsSubscriber As Boolean = u.IsSubscriber
0
 
LVL 37

Assisted Solution

by:samtran0331
samtran0331 earned 250 total points
ID: 20385666
>>If I type "membership." the intellisense doesn't kick in and add the new value to the list of choices?
If you:
Dim u As CustomUser = Membership.GetUser(Page.User.Identity.Name)

You are still using the default MS provider, not the custom one...

If you're using that exact sample class MS provided (because they wrapped it in a namespace), from a page, you would get the the "IsSubscriber" property with (I faked the parameters to be able to Dim the myUser object):

        Dim key As New Object
        Dim myUser As New Samples.AspNet.Membership.VB.OdbcMembershipUser("providername", "username", key, "email", "pwdQ", "comment", True, False, Now, Now, Now, Now, Now, True, "custID")
        myUser.IsSubscriber = True


0
 
LVL 2

Author Comment

by:Starr Duskk
ID: 20385708
samtran,

But you're passing in all the stuff just to retrieve it again. I want to use it from when I logged in. I created the user when I logged in. Now I should be able to use it within redefining it shouldn't I?

I mean, what's the point of creating a new user to retrieve that stuff if I already have it handy right there. Why don't I just use the value I'm passing in. It doesn't make sense.
0
 
LVL 2

Author Comment

by:Starr Duskk
ID: 20385770
Okay, I did annoyes version of GetUser() combined with samtran's custom namespace stuff and that's what I need.

I only need to pass in the username, because I've already defined everything else in my membershipprovider once, and so using the username only is all I need once they've logged in.

thanks!
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question