Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Professional ASP.NET 4 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Professional ASP.NET 4 in C# and VB by Bill Evjen, Scott Hanselman, Devin Rader; ISBN: 9780470502204
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 19th, 2011, 11:59 AM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default ProfileCommon not Supported

So in trying to wire up new properties for the Profile, I've discovered that ProfileCommon and Profile are not supported in VS 2010 . I'd like suggestions on the best strategy for handling Profile info in Web Applications ( I hear it's still supported the way the book presents it in Web Sites.)

If I write a class for my own ProfileCommon 'Like' class, inheriting ProfileBase, will it save all my properties to the profile provider just by executing the pc.save method ?

Or is it better to just go all in and write it with my own database table and save method .....just skipping the whole Profile system ?

Can't believe they hype this feature and then disconnect it.

VB.net appreciated.
Thanks for any insights.
  #2 (permalink)  
Old September 26th, 2011, 02:13 PM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Profile but not as documented

If you write a class and call it ProfileCommon and put it in a folder called App_Code you will get an error that says you are duplicating the class. VS2010 does generate code for a ProfileCommon class and stores it in a temp file. If you find it, and add it to your project, you get the same error , but indicating a new temp file. You can't use intellisense, but the profile system is working. But not the way the books document it.

Don't write a ProfileCommon class or other custom class. Add properties to the web.config as documented (just remember them so you can write your code without intellisense) The following code saved a custom property (FirstName) to the profile database (you may have to refresh your connection or close the table and reopen it to see it). The code was placed in the RegisterUser_CreatedUser method. On a new registerwizard first step page, I placed a textbox named txtFirstName. BTW, have you noticed that the Profile table is in the default database?




Protected Sub RegisterUser_CreatedUser(ByVal sender As Object, ByVal e As EventArgs) Handles RegisterUser.CreatedUser

FormsAuthentication.SetAuthCookie(RegisterUser.Use rName, False)



Dim pf As ProfileBase = ProfileBase.Create(RegisterUser.UserName)

pf.SetPropertyValue("FirstName", txtFirstName.Text)

Dim name As String = pf.GetPropertyValue("FirstName").ToString

pf.Save()

Debug.Print(name)



End Sub



I haven't tried this targeting anyother versions of .NET, like 3.5, but I assume it's all a queston of how VS2010 is handling this issue, not the .NET version.
  #3 (permalink)  
Old September 26th, 2011, 02:15 PM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Profile but not as documented

If you write a class and call it ProfileCommon and put it in a folder called App_Code you will get an error that says you are duplicating the class. VS2010 does generate code for a ProfileCommon class and stores it in a temp file. If you find it, and add it to your project, you get the same error , but indicating a new temp file. You can't use intellisense, but the profile system is working. But not the way the books document it.

Don't write a ProfileCommon class or other custom class. Add properties to the web.config as documented (just remember them so you can write your code without intellisense) The following code saved a custom property (FirstName) to the profile database (you may have to refresh your connection or close the table and reopen it to see it). The code was placed in the RegisterUser_CreatedUser method. On a new registerwizard first step page, I placed a textbox named txtFirstName. BTW, have you noticed that the Profile table is in the default database?


Code:
Protected Sub RegisterUser_CreatedUser(ByVal sender As Object, ByVal e As EventArgs) Handles RegisterUser.CreatedUser

       FormsAuthentication.SetAuthCookie(RegisterUser.UserName, False)


 
Dim pf As ProfileBase = ProfileBase.Create(RegisterUser.UserName)

 pf.SetPropertyValue("FirstName", txtFirstName.Text)
 
Dim name As String = pf.GetPropertyValue("FirstName").ToString

pf.Save()
 
Debug.Print(name)



End Sub
I haven't tried this targeting anyother versions of .NET, like 3.5, but I assume it's all a queston of how VS2010 is handling this issue, not the .NET version.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[newbie] ProfileCommon ? jon80 BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 1 March 14th, 2009 02:43 PM
ShoppingCart is not a member of ProfileCommon sstuber BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 May 21st, 2008 04:55 PM
Why docodeSubDirectories cause ProfileCommon error Joe@Tulsa BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 3 March 3rd, 2008 12:15 PM
ProfileCommon not defined error flyer ASP.NET 2.0 Basics 0 September 26th, 2007 08:07 PM
ProfileCommon Compilation Error bleitner ASP.NET 2.0 Professional 1 January 15th, 2006 03:03 PM



All times are GMT -4. The time now is 07:42 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.