Wrox Programmer Forums
|
BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9
This is the forum to discuss the Wrox book Professional ASP.NET 3.5: In C# and VB by Bill Evjen, Scott Hanselman, Devin Rader; ISBN: 9780470187579
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 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 October 5th, 2009, 05:50 PM
Authorized User
 
Join Date: Aug 2009
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Profile

I use VS 2008 with SP1

I create the profile properties in the web.config file, but after I rebuild the website, the IntelliSense doesn't see the properties of the Profile?

The errorlist is clean...why could this be?
 
Old December 4th, 2009, 10:05 AM
Registered User
 
Join Date: Dec 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've been having trouble with this, too. Have you found a solution?

Likewise, if I find something I'll be sure to post it here for you.
 
Old December 4th, 2009, 12:46 PM
Registered User
 
Join Date: Dec 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I found a solution that appears to work. I haven't tested this in a production application so this is a 'use at your own risk' thing.

What I'm using is WebProfileBuilder.

To get it working, you'll want to download and install the .msi file from the link above. When that's installed, do the following.

1) Start a new Web Application. (Example: WebApplication1) When created, close Visual Studio.
2) Go to your application path and open the WebApplication1 Visual Basic Project file in Notepad. (The guide on the link above is going to tell you to do some unloading and crap to open the file, but in VS2008 Professional, this wasn't an option for me.)
3) Do a find on Import Project="$...
4) Add the following to the Import Project group:
Code:
<Import Project="$(MSBuildExtensionsPath)\WebProfileBuilder\WebProfileBuilder.targets" />
5) Save the file.
6) Open Visual Studio 2008 and reload your project. There will be a dialog box that is popped up. Select Load Project Normally and hit OK...

...Half way there! Now we need to create the class and load it manually.

7) In your Solution Explorer, hit the Show All Files button at the top.
8) Press the Refresh button... twice.

...Now you should see two files in the root of your application: WebProfile.vb and WebProfileBuilder.user

9) Right-click WebProfile.vb and select Include in Project.

Now, jump into your web.config and add the following in <configSections>...
Code:
<sectionGroup name="robo.webProfile">
			<section name="webProfileSettings" type="WebProfileBuilder.WebProfileConfigurationSection, WebProfileBuilder, Version=1.3.0.0, Culture=neutral, PublicKeyToken=01d50f1f82943b0c" allowLocation="true" allowDefinition="Everywhere"/>
		</sectionGroup>
Note: This will be it's own SectionGroup.

Lastly, if you want to modify the settings of the class that is created, drop the following block in the web.config - somewhere as a child of <configuration>, but after the <sectionGroup> you previously added.
Code:
<robo.webProfile>
	<webProfileSettings 
className="MyWebProfile" 
nameSpace="CustomNameSpace" 
directory="CodeFiles" 
fileName="MyWebProfile"/>
</robo.webProfile>
Note: This is just for personalizing the class. Not all the attributes are needed, either. If you only want to change the directory then just add that attribute.

Now, when you do your normal manipulation to the <Profile> section of your web.config, you'll notice that the class will rebuild itself to include a property for that personalization profile property.

To get the Intellisense to work on your .aspx page, you'll need to add a property on the page to get the class object.

Code:
Partial Public Class _Default
    Inherits System.Web.UI.Page

    Public ReadOnly Property Profile() As WebApplication1.WebProfile
        Get
            Return New WebApplication1.WebProfile(HttpContext.Current.Profile)
        End Get
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Now we can use intellisense
        Profile.Whatever = "Something"
    End Sub

End Class
Hope this helps. Reply back if you're confused.

(Credit to robolize for creating this method.)
 
Old July 5th, 2010, 09:26 PM
Authorized User
 
Join Date: Jun 2010
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default project file?

The truth is, I don't see a project file in the folder where my other files are. Where would I actually paste the "<Import Project..." text?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Profile in BLL Faith ASP.NET 2.0 Professional 3 August 18th, 2008 10:57 AM
how to use shoppingcart without profile? hertendreef ASP.NET 2.0 Basics 6 January 11th, 2007 05:16 AM
profile object davyquyo ASP.NET 2.0 Basics 6 December 28th, 2006 07:50 AM
Profile in BLL Faith BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 September 14th, 2006 03:57 AM
delete profile ?? n/a Forum and Wrox.com Feedback 6 August 8th, 2003 03:24 PM





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