Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 28th, 2006, 06:43 AM
Authorized User
 
Join Date: May 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bcr212
Default xxx is not a member of 'Membership'

Hi,
I'm getting 4 constant errors that I cant find the answer to:

1.
ValidateUser is not a member of 'Membership'. Checkout.aspx.vb. Line 147.

2.
ValidateUser is not a member of 'Membership'. CreateDefaultUsers.aspx.vb. Line 23.

3.
CreateUser is not a member of 'Membership'. Checkout.aspx.vb. Line 24.

4.
GetAllUsers is not a member of 'Membership'. LoginDetails.aspx.vb. Line 14.

Can anyone please tell me whats gone wrong ? I'm finding the solution evasive.
Thanks.

 
Old June 28th, 2006, 01:14 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You have to create an instance of your Membership Provider and use the methods of that.
Example:

Dim m As SqlMembershipProvider = CType(Membership.Providers("MySqlProvider"), SqlMembershipProvider)
   If m.ValidateUser(tbUserName.Text, tbPassword.Text) = True Then
   'setting the cookie is needed to show authorazion
   FormsAuthentication.SetAuthCookie(tbUserName.Text, False)
   'OR use RedirectFromLoginPage()
End If

 
Old June 28th, 2006, 03:33 PM
Authorized User
 
Join Date: May 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bcr212
Default

Thanks for that - I'll try it......

 
Old June 28th, 2006, 04:31 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

ok let me know how it goes.

 
Old June 29th, 2006, 06:19 AM
Authorized User
 
Join Date: May 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bcr212
Default

Hi,
My LoginDetails.aspx.vb file looks like:
----------------------------------------------------------
Partial Class LoginDetails
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not Page.IsPostBack Then
            ' make sure the page can't be accessed in real mode
            If ConfigurationManager.AppSettings("mode") = "Real" Then
                MessagePanel.Visible = True
                UsersRolesPanel.Visible = False
            End If

            UserList.DataSource = Membership.GetAllUsers()
            UserList.DataBind()
            UserList.SelectedIndex = 0

            RoleList.DataSource = Roles.GetAllRoles()
            RoleList.DataBind()
            RoleList.SelectedIndex = 0
        End If

    End Sub

    Protected Sub UserList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles UserList.SelectedIndexChanged

        RolesForUser.DataSource = Roles.GetRolesForUser(UserList.SelectedValue)
        RolesForUser.DataBind()

    End Sub

    Protected Sub RoleList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RoleList.SelectedIndexChanged

        UsersInRole.DataSource = Roles.GetUsersInRole(RoleList.SelectedValue)
        UsersInRole.DataBind()

    End Sub
------------------------------------------------------------------
Line 14 is; UserList.DataSource = Membership.GetAllUsers()
I have one member in my table called Membership, that member is in all roles, ie admin etc., I take it line 14 is getting all users from the membership table. Having looked at http://msdn.microsoft.com/library/de...ovMod_Prt1.asp
I conclude that ValidateUser is saying that 'someuser' is not in the membership database ? If I am correct who is that user ? My SQLEXPRESS server is set to use 'Network Service' for logon control, so is that the user I am logged on to my Pc as ? If so, should I create that user as a member of the membership table ?
Did look at your answer but didnt truely understand it and wanted to understand the mechanism more anyway.
Thanks in advance.

 
Old June 29th, 2006, 09:07 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

What errors are you getting and on what lines of code? Are you using a login control? Create user control?

You need to supply more detailed info with errors and what line the error(s) are on.

 
Old June 29th, 2006, 10:22 AM
Authorized User
 
Join Date: May 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bcr212
Default

Hi,
Errors are occuring on build site (F5) in Visual Web Developer 2005 Express, its then that I get the error codes as described in first post...(above). I am using a login control (std from Wrox United download).
You say "You need to supply more detailed info with errors and what line the error(s) are on." - this is as first post - do you need more ? How can I give you more ? There is a create user control, I suspect its not related.
Specifically - Error #4 - "GetAllUsers is not a member of 'Membership'. LoginDetails.aspx.vb. Line 14." - what does this mean, i.e. what is it trying to tell me ?
Confused. Hope this helps, thanks for perseverance.

 
Old June 29th, 2006, 10:41 AM
Authorized User
 
Join Date: May 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bcr212
Default

More info (in the hope that it helps):
I have the primary development website on my laptop, when I F5 build it I get no errors, when I copy it to my server and do a "aspnet_compiler -v THC2) I get "error BC30456: 'ValidateUser is not a member of 'Membership'." on my server when I open the website in Visual Web Developer 2005 Express and start debugging (F5) I get no errors ! So I conclude that the problem is local (to laptop) - so, whats different ? answer = one runs on a local (laptop) SQL & ASPNETDB.mdf and the other runs on a different (server) SQL & ASPNETDB.mdf. So I conclude that the problem lies in one of the SQL & ASPNETDB.mdf (server or local based) areas. Does that make sense ?






Similar Threads
Thread Thread Starter Forum Replies Last Post
parent.frames.xxx how to add text? and Javascript How-To 0 July 18th, 2008 09:12 AM
New option("xxx", "xxx") Ma7T Javascript How-To 3 August 3rd, 2005 09:42 AM
App.xxx ONLY via API - Help ! Peppiniello Pro VB 6 1 December 23rd, 2004 04:38 PM
Http://localhost/xxx/xxx/xxx.aspx Question bekim BOOK: ASP.NET Website Programming Problem-Design-Solution 2 June 11th, 2004 09:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.