Welcome to MSDN Blogs Sign in | Join | Help

Rahul Soni's blog

Never assume the obvious is true!

News



  • These postings are provided "AS IS" with no warranties, and confers no rights.
Unable to change the DisplayMode of a WebPartManager

I had an issue where I was changing a WebPartManger's displaymode using the following code...

WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode
or
WebPartManager1.DisplayMode = WebPartManager.EditDisplayMode

I didn't use SQL Express for my database. Instead I was using my Web.config to configure my SQL 2000 to store Website's information as follows...

<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=aspnetdb;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>

Whenever I tried to browse my page, it worked fine. But as soon as I tried to change the DisplayMode here is the error message which I got...

Server Error in '/WebPartBlogFinal' Application.

The specified display mode is currently disabled on this page. Make sure personalization is enabled for the current user.
Parameter name: value

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: The specified display mode is currently disabled on this page. Make sure personalization is enabled for the current user.
Parameter name: value


Stack Trace:


[ArgumentException: The specified display mode is currently disabled on this page. Make sure personalization is enabled for the current user.
Parameter name: value]
   System.Web.UI.WebControls.WebParts.WebPartManager.set_DisplayMode(WebPartDisplayMode value) +864643
   ASP.default_aspx.CustomizePage(Object s, EventArgs e) in c:\inetpub\wwwroot\WebPartBlogFinal\Default.aspx:4
   System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +105
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +107
   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

Version Information:
 Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

To solve this error...

I had my "Enable Anonymous Access" Checked along with "Integrated Windows Authentication"
I unchecked my "Enable Anonymous Access" and ran the application again. Now, it works just fine.

In case you want to reproduce this issue, try the code from http://blogs.msdn.com/rahulso/archive/2006/03/18/554590.aspx

Create a website against your IIS and instead of SQLExpress use, SQL Server and configure it as the <connectionStrings> above.
Now, run the application with Anonymous access and it should fail. With Integrated Authentication it shouldn't.

Download the Express Edition of Microsoft SQL Server Management Studio. Management Studio Express (SSMSE) provides a graphical management tool for SQL Server 2005 Express Edition (SQL Server Express) instances. http://www.microsoft.com/downloads/details.aspx?familyid=82afbd59-57a4-455e-a2d6-1d4c98d40f6e&displaylang=en

Hope that helps.

Posted: Wednesday, March 29, 2006 1:44 AM by rahulso
Filed under: ,

Comments

ArunKumar A. said:

Hi Rahul, the solution that u have provided is really good. It works. Tnx for it.

# June 16, 2007 2:18 AM

rooor_b said:

my Os is Vista so this did't work with me

i disable anonymous authintication & enabled windows authintication but it didn't work it ask me for username and password

can any one help me in that

# March 16, 2008 11:07 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker