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.)