Logo 
Search:

MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

SharePoint 2007 Webparts and ASP.NET profiles problem

  Asked By: Rey    Date: Jul 28    Category: MOSS    Views: 2176

I'm trying to use ASP.NET 2.0 personalization (profiles) in my
SharePoint
2007 webparts.
ASP.NET SQL database is configured through aspnet_regsql.exe utility,
and
corresponding connection parameters are added to the config (see
below).
But when I try to gain access to the Context.Profile object using
this code,
for example:
-----------
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
ProfileBase b = Context.Profile;
}
-----------

But Context.Profile object is always "null"! Static members are
initialized
properly
and contain right information, e.g. in "Properties" parameter (two
fields,
"Name"
and "System").

MSDN tells: "A Profile property is used for persistent storage of
structured
data using a type-safe API. When a Profile property is accessed but
no value
is present, an empty instance is returned; a null reference (Nothing
in
Visual Basic) is not returned."

Here are extracts from my web.config file regarding profiles:
----------------------------------------------
......
<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer"
connectionString="Data Source=SPS;Initial
catalog=aspnetdb;Integrated
Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
......
<profile enabled = "true">
<providers>
<clear />
<add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="LocalSqlServer"
applicationName="/"
description="Stores and retrieves profile data from the
local
Microsoft SQL Server database" />
</providers>
<properties>
<add name="Name" type="System.String"/>
<add name="System" type="System.String"/>
</properties>
</profile>
......
----------------------------------------------

If anybody knows how to solve this problem, I'll be very grateful

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Willard Valenzuela     Answered On: Jul 28

I'm not sure that this will solve your problem  since I haven't played around enough with ProfileProviders yet. But in order to use the ProfileProvider in ASP.NET 2.0 don't you need to also use the MembershipProvider? Using the MembershipProvider would mean running the site with Forms Authentication, which is now supported in WSS v3 and MOSS 2007. I know this is required if you want to implement a RoleProvider, but I'm not sure if its required for the ProfileProvider also. But it would make sense that it is.

 
Didn't find what you were looking for? Find more on SharePoint 2007 Webparts and ASP.NET profiles problem Or get search suggestion and latest updates.




Tagged: