WebPartManager.AddWebPart...not understanding exception

S

SlimFlem

I am new to the WebPartManager stuff and am still learning how to set
this up properly. I am creating instances of WebPart classes from
loaded DLLs and add them to the Page's WebPartManager. If I don't have
this property set on the WebPartManager:
Personalization-Enabled="false", the page will hang and not load. If I
do have this, then I get the following exception:

===

System.InvalidOperationException was unhandled by user code
Message="Personalization is not enabled and/or modifiable. The
Enabled property must be set to true, and a registered personalization
provider must be selected. The current user must be granted the right
to modify personalization state."
Source="System.Web"
StackTrace:
at
System.Web.UI.WebControls.WebParts.WebPartPersonalization.EnsureEnabled(Boolean
ensureModifiable)
at
System.Web.UI.WebControls.WebParts.WebPartManager.AddWebPart(WebPart
webPart, WebPartZoneBase zone, Int32 zoneIndex)
at BWC.PublicSite.WebSite.PageLoader.PageLoader_Load(Object
sender, EventArgs e) in
c:\code\BWC.PublicSite2\BWC.PublicSite.WebSite\Members\PageLoader.aspx.cs:line
80
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

===

I thought a default PersonalizationProvider was provided for you by the
WebPartManager and I did not need to create one.

Why would my page hang when I do not have the above mentioned property
on the WebPartManager?

Thanks for any help.
 
J

Joerg Jooss

Hello SlimFlem,
I am new to the WebPartManager stuff and am still learning how to set
this up properly. I am creating instances of WebPart classes from
loaded DLLs and add them to the Page's WebPartManager. If I don't
have this property set on the WebPartManager:
Personalization-Enabled="false", the page will hang and not load. If
I do have this, then I get the following exception: [...]
I thought a default PersonalizationProvider was provided for you by
the WebPartManager and I did not need to create one.

Why would my page hang when I do not have the above mentioned property
on the WebPartManager?

I struggled with this one as well.

Is your web application set up for personalization? If not, this isn't going
to work. The easiest way to do that (quick and dirty) is to disable anonymous
access in IIS and enforce Windows Authentication, in which case personalization
wll be based on your Windows account.

For real world (internet) applications, you'll want to set up personalization
with Forms Authentication like documented on MSDN.

Cheers,
 
S

SlimFlem

To sum it up, all I want to do is, build a regular website that is
browseable by everyone, does not have the requirement to ever enter
edit mode, design mode, etc (at the moment). The pages are being built
dynamically using a backend CMS system and various other "pieces" which
are WebPart classes in separate DLLs, not the App_Data folder of the
application.

It does not make sense to me why MS assumes/forces you to use
Personalization if you don't want/need it. Dynamically loading
WebPart's should not be dependent on Personalization. What is the
logic behind this decision?

I have tried using a Windows account in IIS and disabling anonymous
access and many variations of, but for the life of me, I cannot get
past the exception I posted in my first post. It's about to drive me
mad.
 
S

SlimFlem

And also, I have properly setup the aspnetdb on a SQL Server 2000
machine and set the proper connection string for it, but it's like it
doesn't even exist when I attempt to run the application.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top