Does anyone have ASP.Net 2.0 Profiles working in a Web Application Project?

N

nathan.haywood

I saw several posts, but no real answers about this. I've been playing
with the Profile classes in a sample Web Site, but cannot seem to get
the Profile to work in my actual Web Application Project. I am able to
add profile properties and/or profile inheritence to the web.config,
but IntelliSense never kicks in on any of my pages or code-behinds.
When I type Profile, it looks like I may be getting the
System.Web.Profile namespace instead of a page-level Profile
property/accessor?

Can anyone confirm that Profile works with Web Application projects and
that "Profile.MyProperty" works on pages in W.A. projects?

ex. (works perfect in Web Site, but not in Web Application)

[web.config]
....
<anonymousIdentification enabled="true"/>
<profile defaultProvider="myProfileProvider">
<providers>
<clear/>
<add name="myProfileProvider"
connectionStringName="myConnectionString"
type="System.Web.Profile.SqlProfileProvider"/>
</providers>
<properties>
<add name="FullName" defaultValue="Guest" allowAnonymous="true"/>
<add name="Birthday" type="System.DateTime" allowAnonymous="true"/>
</properties>
</profile>
....

[default.aspx.vb]
....
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not IsPostBack Then
BindFields()
End If
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Profile.FullName = TextBox1.Text
BindFields()
End Sub

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
Profile.Birthday = Calendar1.SelectedDate
BindFields()
End Sub

Private Sub BindFields()
Label1.Text = Profile.FullName
Label2.Text = Profile.Birthday.ToShortDateString
End Sub
....
 
N

nathan.haywood

So is this a confirmed (by MS? by users?) known problem in VS05? Is
this something MS is working on? (say, maybe, VS05 SP1?)

Am I just using an out of date version of the Web Application Project
addons? How can I tell which version I have?
Hey Nathan,

I was exactly looking for the same thing today. Here is some
information, that might help you.

http://www.gotdotnet.com/workspaces/workspace.aspx?id=406eefba-2dd9-4d80-a48c-b4f135df4127

Thanks,
Raj

I saw several posts, but no real answers about this. I've been playing
with the Profile classes in a sample Web Site, but cannot seem to get
the Profile to work in my actual Web Application Project. I am able to
add profile properties and/or profile inheritence to the web.config,
but IntelliSense never kicks in on any of my pages or code-behinds.
When I type Profile, it looks like I may be getting the
System.Web.Profile namespace instead of a page-level Profile
property/accessor?

Can anyone confirm that Profile works with Web Application projects and
that "Profile.MyProperty" works on pages in W.A. projects?

ex. (works perfect in Web Site, but not in Web Application)

[web.config]
...
<anonymousIdentification enabled="true"/>
<profile defaultProvider="myProfileProvider">
<providers>
<clear/>
<add name="myProfileProvider"
connectionStringName="myConnectionString"
type="System.Web.Profile.SqlProfileProvider"/>
</providers>
<properties>
<add name="FullName" defaultValue="Guest" allowAnonymous="true"/>
<add name="Birthday" type="System.DateTime" allowAnonymous="true"/>
</properties>
</profile>
...

[default.aspx.vb]
...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not IsPostBack Then
BindFields()
End If
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Profile.FullName = TextBox1.Text
BindFields()
End Sub

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
Profile.Birthday = Calendar1.SelectedDate
BindFields()
End Sub

Private Sub BindFields()
Label1.Text = Profile.FullName
Label2.Text = Profile.Birthday.ToShortDateString
End Sub
...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top