Solved

ASP.NET Personalization Error

Posted on 2010-08-25
7
1,139 Views
Last Modified: 2013-11-07
In development I just added some elements to the profile object that I'm trying to associate with my users.  It works great in dev, with this code in my web.config:

            <profile>
                  <properties>
                        <add name="Nickname" defaultValue="default"/>
                        <add name="Initials" defaultValue="default"/>
                        <add name="PRO" defaultValue="default"/>
                        <add name="Phone" defaultValue="default"/>
                  </properties>
            </profile>


When I add that to my web.config in Prod, I get this error for my entire web app:
This application was precompiled with personalization turned off, but it appears to have been turned on after the precompilation, which is not supported.

How do I turn on personalization?  I tried putting the following in my Prod web.config, but still got the error:
            <webParts>
                  <personalization defaultProvider="MyAspNetSqlPersonalizationProvider">
                        <providers>
                              <add connectionStringName="LocalSqlServer" name="MyAspNetSqlPersonalizationProvider" type="System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                        </providers>
                  </personalization>
            </webParts>
0
Comment
Question by:JT_SIRO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 33526736
Have you recompiled and re-deployed the app or have you literally just added those elements to the config on your live site? If it's the latter then you need to re-build and re-deploy the site.
0
 

Author Comment

by:JT_SIRO
ID: 33527222
Yea, I just added the profile code to the web.config on my server.  When you say re-deploy, what does that mean exactly?  My app consists of dozens of aspx pages.  Do they all need to be copied over?  I guess I don't know how the production server is to know that the app has been recomplied, unless it was in the web config.  Please advise.  Thanks,

Justin
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 33529148
When you compile your site the compiler takes the profile information and dynamically generates a class to strongly-type your profile values. Which means you can't just add profile information to your live site without recompiling the site.

If none of your aspx pages have changed then you may be able to get away with simply recompiling and deploying just the updated dll.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:JT_SIRO
ID: 33534222
I use single page assemblies when I compile, so there's a dll for every page in my site (about 40).  Do I need to compile and move them all over then?  I'm guessing that I do, because every page I try to navigate to produces the error.  That's where my confusion was.  If the web.config can't fix it, I think I'd need to replace them all.  Why is that not just a web.config setting?  That seems strange.  thx -
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 250 total points
ID: 33534340
The web.config values purely serve as a way to define what values you want to store in the profile. The app needs to be compiled because it needs to create a strongly-typed class based on the values in the config file. Basically so that it is able to correctly serialize the values to and from the underlying membership database.
0
 

Author Comment

by:JT_SIRO
ID: 33534626
I recompiled, then moved one pages aspx and dll over to my prod server.  
I then manually added the profile tag to my prod web.config.
When I navigated to that page, I got the error message again.

My web.config code is below.
		<httpRuntime executionTimeout="1000"  maxRequestLength="1000000" />
		<membership>
			<providers>
				<remove name="AspNetSqlMembershipProvider"/>
				<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer"  enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="7" maxInvalidPasswordAttempts="5" />
			</providers>
		</membership>

		<webParts>
			<personalization defaultProvider="MyAspNetSqlPersonalizationProvider">
				<providers>
					<add connectionStringName="LocalSqlServer" name="MyAspNetSqlPersonalizationProvider" type="System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
				</providers>
			</personalization>
		</webParts>

		<profile>
			<properties>
				<add name="Nickname" defaultValue="default"/>
				<add name="Initials" defaultValue="default"/>
				<add name="PRO" defaultValue="default"/>
				<add name="Phone" defaultValue="default"/>
			</properties>
		</profile>

Open in new window

0
 

Author Comment

by:JT_SIRO
ID: 33535124
I've got it working now.  I seemed to have forgotten to copy my app code dll over.  Brilliant...  
Thanks a ton for your help
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question