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 December 3rd, 2010, 06:21 AM
Authorized User
Join Date: May 2007
Posts: 73
Thanks: 4
Thanked 0 Times in 0 Posts
Default Adding new properties in .net membership

My application uses .net membership, I added some new properties but on calling Profile.save() it still save the old values, What i am doing wrong?

   <roleManager defaultProvider="AspNetSqlRoleProvider" enabled="true">
        <add name="AspNetSqlRoleProvider" connectionStringName="gmembers" applicationName="/MobileToday" type="System.Web.Security.SqlRoleProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    <profile enabled="true" defaultProvider="gMembersProfileSqlProvider">
        <remove name="gMembersProfileSqlProvider"/>
        <add name="gMembersProfileSqlProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="gmembers" applicationName="/MobileToday"/>
      <!-- Define the properties for Profile... -->
          <add name="Title" allowAnonymous="true"/>
          <add name="FirstName" allowAnonymous="true"/>
          <add name="LastName" allowAnonymous="true"/>
          <add name="Gender" type="string"/>
          <add name="Company" allowAnonymous="true"/>
          <add name="Address" allowAnonymous="true"/>
          <add name="Avatar" allowAnonymous="true"/>
          <add name="Newsletter" allowAnonymous="true"/>
          <add name="AcceptMailUs" allowAnonymous="true"/>
          <add name="AcceptMailOthers" allowAnonymous="true"/>
          <add name="imageORavatar" allowAnonymous="true"/>
          <add name="Mobile" allowAnonymous ="true"/>
          <add name ="JobTitle" allowAnonymous ="true" />
          <add name ="StoreNumber" allowAnonymous ="true"/>
          <add name="BusinessAddress" allowAnonymous ="true"/>
          <add name="BusinessPostcode" allowAnonymous ="true"/>
          <add name="BusinessTown" allowAnonymous ="true"/>
          <add name="BusinessPhone" allowAnonymous ="true"/>
          <add name="CompanyTypeID" allowAnonymous ="true"/>
          <add name="CompanyTypeName" allowAnonymous ="true"/>
          <add name="CompanyNameID" allowAnonymous ="true"/>
          <add name="JobFunctionID" allowAnonymous ="true"/>
          <add name="JobFunctionName" allowAnonymous ="true"/>
    <anonymousIdentification enabled="true" cookieName=".ASPXANONYMOUS" cookieTimeout="43200" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All" cookieless="UseCookies"/>

    <authentication mode="Forms">
      <forms name=".TestAuth" loginUrl="login.aspx" defaultUrl="~/__admin/pages/viewlist.aspx"></forms>
      <!--<allow roles="Admin" />
      <allow roles="Editor" />
      <deny users="?" />
      <deny users="*" />-->
    <membership defaultProvider="MyAspNetSqlMembershipProvider">
        <add name="MyAspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=, 
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="gmembers" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="20" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/MobileToday"/>

   Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click
        ReturnUrl = Trim(Request.QueryString("ReturnUrl"))
        '  Try
        'If Page.IsValid Then
        Dim newsletter As Integer = If((chkNewsletter.Checked), 1, 0)
        Dim acceptmailus As Integer = If((chkAcceptMailUs.Checked), 1, 0)
        Dim acceptmailothers As Integer = If((chkAcceptMailOthers.Checked), 1, 0)
        Dim imageORavatar As String

        Dim utl As New Utilities()

        'create user
        'profile add

            Membership.CreateUser(Session("RegisterUsername").ToString(), utl.Decrypt1(Session("RegisterPassword").ToString()), Session("RegisterEmail").ToString())
        Catch ex As MembershipCreateUserException
            'Throw ex
        End Try

        Profile.Title = txtTitle.Text
        Profile.FirstName = txtFirstName.Text
        Profile.LastName = txtLastName.Text
        If DDCompanyName.SelectedValue.ToString = "999" Then
            Profile.Company = txtCompanyNameOther.Text
            Profile.Company = DDCompanyName.SelectedItem.Text
        End If

        Profile.Address = txtAddress.Text
        Profile.Avatar = "" 'thumbnailFileName1
        Profile.Newsletter = chkNewsletter.Checked.ToString()
        Profile.AcceptMailUs = chkAcceptMailUs.Checked.ToString()
        Profile.AcceptMailOthers = chkAcceptMailOthers.Checked.ToString()
        Profile.imageORavatar = 2 'imageORavatar // Set 2 For Default Avatar
        Profile.JobTitle = txtJobTitle.Text
        Profile.StoreNumber = txtStoreNumber.Text
        Profile.BusinessAddress = txtBusinessAddress.Text
        Profile.BusinessPostcode = txtBusinessPostcode.Text
        Profile.BusinessTown = txtBusinessTown.Text
        Profile.BusinessPhone = txtBusinessPhone.Text

        Profile.CompanyNameID = DDCompanyName.SelectedValue
        Profile.CompanyTypeID = DDCompanyType.SelectedValue

        If DDCompanyType.SelectedValue.ToString = "999" Then
            Profile.CompanyTypeName = txtCompanyNameOther.Text
            Profile.CompanyTypeName = DDCompanyType.SelectedItem.Text
        End If
        Profile.JobFunctionID = DDJobFunction.SelectedValue

        If DDJobFunction.SelectedValue.ToString = "999" Then
            Profile.JobFunctionName = txtJobFunctionOther.Text
            Profile.JobFunctionName = DDJobFunction.SelectedItem.Text
        End If

        FormsAuthentication.SetAuthCookie(Session("RegisterUsername").ToString(), False)

        '  End If
        'Catch ex As Exception
        'End Try

        If ReturnUrl = "" Then
            Response.Redirect("success.aspx?ReturnUrl=" & HttpUtility.UrlEncode(ReturnUrl))
        End If

    End Sub
Old December 27th, 2010, 11:46 AM
Authorized User
Join Date: Dec 2010
Posts: 21
Thanks: 4
Thanked 1 Time in 1 Post

What is your resource for this code?

Similar Threads
Thread Thread Starter Forum Replies Last Post
.net membership issue dotnet_user ASP.NET 3.5 Basics 9 January 24th, 2012 11:45 AM
Question about Asp.net Membership chobo2 ASP.NET 3.5 Basics 3 April 2nd, 2009 04:02 PM
Help with ASP.NET Membership VerbatimBOT SQL Server 2000 6 May 2nd, 2007 01:58 PM
Roles and membership asp.net 2 zeeshannasir ASP.NET 2.0 Basics 2 September 15th, 2006 07:24 AM
Adding Properties to Buttons in a GridView Aaron Edwards ASP.NET 2.0 Basics 3 July 23rd, 2006 01:48 PM

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