ASP.NET: WebPart Close and Minimize Links

I have a WebPart (code is below) that works fine with retrieving my data from DB, but it does not display the Minimize and Close links.

<%@ Page Language="VB" %>
<%@ register src="App_Data/databind.ascx" tagname="displaymodevb" tagprefix="uc2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
    <title>Untitled Page</title>
    <form id="form2" runat="server">
<asp:WebPartManager ID="WebPartManager2" runat="server" />

        <asp:WebPartZone ID="WebPartZone2" runat="server">
                        <uc2:displaymodevb id="grid9" runat="server" title="First Web Part" width="500" />        

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It looks like you are looking the page as anonymus user (not authenticated).

You can try next:
1. Open IIS management console
2. Go to your web site and then to virtual directory for the application hosting your web page with web part
3. Right click on virtual directory and select "Options"
4. Go to "Directory Security" tab and click on "Edit..."
5. Deselect "Allow anonymus..."
6. Select "Integrated Windows Authentication"

Run your project again and check if there are minimize and close options. The thing is that personalization works only for authenticated users.

asp_net2Author Commented:
That did not work. Also this application must be viewable to anyone outside the network. See the error message below.

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

Source Error:

Line 9:  <script runat="server">
Line 10:     Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Line 11:         WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode
Line 12:     End Sub
Line 13: </script>
You are getting that error message because you probably didn't setup authentication mechanism. When you give your users rights to personalize their account (by minimizing certain web parts for example) then they need to be authenticated.

Check answers on this post:

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

asp_net2Author Commented:

I still have no idea. Please see below of what I added from the link you provided me. Now when I add this code it does not authenticate.


    <add name="SQLConnString" connectionString="Data Source=TEST;Initial Catalog=aspnetdb;User ID=sa;Password=test1234" providerName="System.Data.SqlClient" />

          <add name="SqlPersonalizationProvider" type="System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider" connectionStringName="PSSA" applicationName="/" />
          <deny users="*" verbs="enterSharedScope" />
          <allow users="*" verbs="modifyState" />
You can solve it like this:

<authentication mode="Windows" />
to your Web.config.

Then go to a page in your web site, log-in and then try to access your page with web part.
NB: you can set authentication to "Forms" also if you want it to be accessible from internet users. But you can not bring a user to "edit" mode on web parts page if he/she is not authenticated.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
asp_net2Author Commented:

That worked. I just have a few questions before closing.

1.) How can I also include authentication = forms within the same web.config file? I have a login form that I created manually for a few pages that authenticate the user from an SQL DB.

2.) What else do I need to add to enable my application to use the aspnet DB that comes with ASP.NET 2 for membership and roles.

3.) Do I even need this aspnet DB to use web parts? Or can I go without it if I'm not worried about authenticating people?
Hm, those are 3 new questions :-)

1.) Just change <authentication mode="Windows" />  into <authentication mode="Forms" /> You can check next article on how to use and configure forms authentication:
2.) First of all, you don't need to use Membership and Role providers with Forms authentication but you can do that. It is not that trivial thing so I suggest you first read about it a litle. This may help:
3.) You don't need the aspnet DB but you need to have an authentication mechanism. So you can authenticate users using Windows authetnication but then you need to have all users of you web site registered in windows (or ActiveDirectory), using Forms authentication (with aspnet DB and Membership provider) or with some other authentication mechanism.

I hope these answers are enough for successfuly closing of this question ;-)

If you have questions related to forms authentication, membership and role providers or something similar then I suggest you open a new question(s).

asp_net2Author Commented:

Thanks again. One more question I forgot to add. I promise :) I will definetly close after this.

1.) When I run my page all is well but what determines the application for remembering when i minimize a webpart. For example I ran the webpart page and minimized the webpart and then closed the browser. When i ran the webpart page again the webpart was still minimized. What causes this to remember my selection?
The personalization feature that is part of portal framework.
There is a plenty of articles about that on web. Here are some of them:


asp_net2Author Commented:
Thanks for all your help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.