Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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 March 5th, 2008, 10:34 PM
Authorized User
 
Join Date: Sep 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default How i can modify the User profle

i want to modify the user profile, that i don't use aspnet_profile but i will build a table which associate with Username, Firstname, and so on. i want some idea to modify it
                                        thank

 
Old March 5th, 2008, 11:57 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

See here:

http://msdn2.microsoft.com/en-us/library/f1kyba5e.aspx

 
Old March 13th, 2008, 12:51 AM
Authorized User
 
Join Date: Mar 2008
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What you want to do is probably already written for you here:

http://www.asp.net/downloads/sandbox...vider-samples/

Just download the sample and read the whitepaper. Good luck!

 
Old March 21st, 2008, 07:29 AM
Authorized User
 
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to kalel_4444
Default

I just completed working through the membership section of the book, and upon completion I asked this very question. Thanks for the link, the SqlStoredProcedureProfileProvider worked great!

Thanks slatergator


 
Old March 22nd, 2008, 02:22 AM
Authorized User
 
Join Date: Mar 2008
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by kalel_4444
 I just completed working through the membership section of the book, and upon completion I asked this very question. Thanks for the link, the SqlStoredProcedureProfileProvider worked great!

Thanks slatergator
You're welcome! I agree, both of those 2 types of new providers work very well. I used it on www.flixgadget.com . I wouldn't be surprised if they became standard in the new version of ASP.NET.

==========================
what's your mood?
http://www.flixgadget.com
 
Old March 24th, 2008, 09:02 AM
Authorized User
 
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to kalel_4444
Default

While I got the sample asp sandbox project to work, I'm having a rough time including it into this books Membership project.

For the sake of testing, I haven't added or changed any properties, I even kept the structure the same by putting the properies in <groups> so no code would have to be changed, yet upon build it breaks when I try to "Register" or "Edit Profile" after logging in, right at:
UserProfile.ascx.cs at (" ProfileCommon profile = this.Profile; "), with an error of:
Could not load type 'Microsoft.Samples.SqlTableProfileProvider'

I think I might have the datatypes defined incorrectly somewhere, either in the properties or in my SQL ProfileTable_1. If someone could take a look at both and let me know I'd appreciate it.

ProfileProvider (WORKS) - dumps into single blob.

      <profile defaultProvider="TBH_ProfileProvider">
         <providers>
            <add name="TBH_ProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
         </providers>
         <properties>
            <add name="FirstName" type="String" />
            <add name="LastName" type="String" />
            <add name="Gender" type="String" />
            <add name="BirthDate" type="DateTime" />
            <add name="Occupation" type="String" />
            <add name="Website" type="String" />
            <group name="Address">
               <add name="Street" type="String" />
               <add name="PostalCode" type="String" />
               <add name="City" type="String" />
               <add name="State" type="String" />
               <add name="Country" type="String" />
            </group>
            <group name="Contacts">
               <add name="Phone" type="String" />
               <add name="Fax" type="String" />
            </group>
            <group name="Preferences">
               <add name="Theme" type="String" allowAnonymous="true" />
               <add name="Culture" type="String" defaultValue="en-US" />
               <add name="Newsletter" type="MB.TheBeerHouse.BLL.Newsletters.Subscription Type" />
            </group>
         </properties>
      </profile>

/************************************************** ********/
SqlTableProfileProvider (BUILD ERROR) - Should update ProfileTable_1 w/all datatypes as [nvarchar], except 'BirthDate' as [datetime].

      <profile enabled="true" defaultProvider="TBH_TableProfileProvider">
         <providers>
            <clear/>

            <add name="TBH_TableProfileProvider"
                         type="Microsoft.Samples.SqlTableProfileProvider"
                         connectionStringName="LocalSqlServer"
                         table="ProfileTable_1"
                         applicationName="/" />
         </providers>
         <properties>
            <add name="FirstName" type="string" defaultValue="[null]" customProviderData="FirstName;nvarchar"/>
            <add name="LastName" type="string" defaultValue="[null]" customProviderData="LastName;nvarchar"/>
            <add name="Gender" type="string" customProviderData="Gender;nvarchar"/>
            <add name="BirthDate" type="datetime" customProviderData="BirthDate;datetime"/>
            <add name="Occupation" type="string" defaultValue="[null]" customProviderData="Occupation;nvarchar"/>
            <add name="Website" type="string" defaultValue="[null]" customProviderData="Website;nvarchar"/>
            <group name="Address">
               <add name="Street" type="string" defaultValue="[null]" customProviderData="Street;nvarchar"/>
               <add name="City" type="string" defaultValue="[null]" customProviderData="City;nvarchar"/>
               <add name="State" type="string" defaultValue="[null]" customProviderData="State;nvarchar"/>
               <add name="PostalCode" type="string" defaultValue="[null]" customProviderData="PostalCode;nvarchar"/>
               <add name="Country" type="string" defaultValue="[null]" customProviderData="Country;nvarchar"/>
            </group>
            <group name="Contacts">
               <add name="Phone" type="string" defaultValue="[null]" customProviderData="Phone;nvarchar"/>
               <add name="Fax" type="string" defaultValue="[null]" customProviderData="Fax;nvarchar"/>
            </group>
            <group name="Preferences">
               <add name="Theme" type="string" defaultValue="[null]" allowAnonymous="true" customProviderData="Theme;nvarchar"/>
               <add name="Culture" type="string" defaultValue="en-US" customProviderData="Culture;nvarchar"/>
               <add name="Newsletter" type="MB.TheBeerHouse.BLL.Newsletters.Subscription Type" defaultValue="[null]" customProviderData="Newsletter;nvarchar"/>
            </group>
         </properties>
      </profile>

Any suggestion appreciated..!

 
Old March 25th, 2008, 10:51 PM
Authorized User
 
Join Date: Mar 2008
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey, did you put both classes in your app_code folder? (both SqlTableProfileProvider and SqlStoredProcedureProfileProvider)

==========================
what's your mood?
http://www.flixgadget.com
 
Old March 26th, 2008, 10:17 AM
Authorized User
 
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to kalel_4444
Default

I CAN'T BELIEVE I MISSED THAT...!!!

I've been breaking my head in the web.config and the userProfile.cs files, going over it line by line. I finally gave up, and moved on to the News & Articles.

I'll put it into action and update upon success.

Slater... Thanks again, you saved me from going nutz.. :)

 
Old March 27th, 2008, 03:04 AM
Authorized User
 
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to kalel_4444
Default

OK..!! It's working :D, mostly anyways. I've encountered 2 items that threw exceptions.

I was able to update all properties w/o the Newsletter property, which is of type=MB.TheBeerHouse.BLL.Newsletters.SubscriptionT ype.

Error 1: Including "Newsletter", an exception was thrown returning GetPropertyValue("Newsletter")

Error 2: Editing a userProfile (specifically the BirthDate), saving, then going back to edit it again, I got another exception returning GetPropertyValue("BirthDate"), which is a [datetime] datatype.

I can understand the error with the datatime. It's trying to query and get a datetime datatype where the code is trying to write a string. I need to convert it somehow (I think that's the problem).

But why the problem with the Newsletter? It's inserting and getting a string/nvarchar, albeit using the enum.cs class for the Newsletter.Subscription, it should still work.. no?

Thanks again Slater, at least I have the classes in place now and I'm back on track.

 
Old March 28th, 2008, 01:54 AM
Authorized User
 
Join Date: Mar 2008
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

the birthdate "type", and the "customproviderdata" in your web.config should have "datetime"...the column in the database should also be of type datetime.

As for the newsletter...perhaps you should try having the customproviderdata type as Binary,Image, or VarBinary. I'm not sure about this one. You might also try using serializeAs="Binary" ?


==========================
what's your mood?
http://www.flixgadget.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
i want to modify the shopping ssomchai BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 April 3rd, 2008 01:52 AM
Help Modify GetThreadsRss kherrerab BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 January 22nd, 2008 12:14 PM
Modify XSLT mikeymikey XSLT 4 January 5th, 2008 11:21 PM
How to modify "for-each" to "last occurrence of" ? nyctechwriter XSLT 3 October 30th, 2006 01:15 PM
How to modify hidden value? Edward King Javascript 2 January 21st, 2006 05:44 AM





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