Solved

ASP.NET Personalization Error

Posted on 2010-08-25
7
1,118 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
  • 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
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I bind a WPF ComboBox to an ItemSource using XAML? 2 30
Data organization issue 7 37
Updating a single record in forEach using C#/Entity 7 24
C# XML Get Values 4 34
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 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