public class ben:harrell

July 26, 2006

Web Parts Manager personalization without SQLExpress

Filed under: .NET, Technology — benjamin harrell @ 3:15 pm

Earlier I posted about wanting to put personalization on a separate SQL instance (not local).  Well, this gives me a chance to say thanks to the MSDN2 team for making more information available in .NET 2.0.  I was a little worried during the BETA because of so many empty pages but MSDN is loaded with good information and plenty of walkthroughs!  There is even a MSDN WIKI found here .  OK here is the answer I promised: 

Personalized settings are not tied to a single browser session. Because they are stored in long-term storage, the application can retrieve a user’s settings each time the user visits a specific page.

Personalization uses an ASP.NET application services database to store personalization data. By default, ASP.NET creates this database automatically in a subfolder named “app_data” when an ASP.NET application first uses personalization or one of the other application services such as roles, membership or profiles. Also by default, ASP.NET creates the database as a single SQL Server Express database file that contains the database schema for all of the application services. Using the Web.config file, you can configure your application so that a separate database file is created for personalization. Further, in the Web.config file, you can specify a SQL Server database to store the application services data instead of using the default SQL Server Express database file.

The mechanism for storing and retrieving personalization data consists of a provider component and a data store. ASP.NET includes a default Microsoft SQL provider and database. You can also create a custom provider and configure it to use any data store.  (THANK GOD!  gotta love the new provider model)

essentially this is the web.config section you need under <system.web>

(the MSDN entry is here for the element)

<webParts><personalization ><providers>

<remove name=AspNetSqlPersonalizationProvider />        

<add connectionStringName=my_connection_stringname=AspNetSqlPersonalizationProvider

type=System.Web.UI.WebControls.WebParts.SqlPersonalizationProviderapplicationName=//>

 </providers></personalization></webParts>

Some of this was information was found in a really good article on personalization here . 


 

technorati tags:, , ,

odd sql 2005 connection error

Filed under: .NET, Technology — benjamin harrell @ 2:46 pm

An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified)

 If all else looks correctly configured then this might be a control using personalization that uses SQLExpress by default.  An example of such a control is the WebPartsManager, this control is a wonderful control in ASP.NET 2.0 and allows for the web part behavior on a page but if you enable the personalization in the properties screen (default is enabled) then this control will attempt to use SQLExpress to store its personalization info.  This might be fine for some sites but not everyone wants to run SQLExpress in production so I disabled personalization for now until I can figure out how to point personalization to a SQL Instance on another server.  I’ll post that as soon as I figure it out, in the meantime if anyone has the answer please fill me in.

Blog at WordPress.com.