Solved

ASP.NET Personalization Error

Posted on 2010-08-25
7
1,091 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now