问题
I am trying to develop web parts in VS 2008/WinXP
I created a Web Site project, and added a couple of web parts within the default form in default.aspx
<form id="form1" runat="server">
<div>
<asp:WebPartManager ID="WebPartManager1" runat="server">
</asp:WebPartManager>
<asp:WebPartZone ID="WebPartZone1" runat="server">
</asp:WebPartZone>
</div>
</form>
When I first ran it (in the debugger), a popup told to me enable Windows authentication in IIS (so something is working!). I enabled the Windows authentication, and now when I run it I get a blank screen. Same result if I open it in IE via the url (rather than debugger).
Note - the source view shows lots of a javascript - in particular, it declares a WebPartManager object, and adds a zone to it (__wpm.AddZone(..)
)
回答1:
Because of Windows User Account Control (UAC), when working with Windows Vista or Windows Server 2008, the local Administrators group will behave differently than other groups. The attribute won’t correctly recognize a member of the local Administrators group unless you modify your computer’s UAC settings.
Exactly what happens when you attempt to invoke a controller action without being the right permissions depends on the type of authentication enabled. By default, when using the ASP.NET Development Server, you simply get a blank page. The page is served with a 401 Not Authorized HTTP Response Status.
If, on the other hand, you are using IIS with Anonymous authentication disabled and Basic authentication enabled, then you keep getting a login dialog prompt each time you request the protected page.
来源:https://stackoverflow.com/questions/2672535/simple-web-parts-in-asp-net-show-as-blank-page