Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sofia, Bulgaria | 9-10 October ASP.NET: Developing Portal UI With Web Parts Goksin Bakir Yage Ltd Microsoft Regional Director, MEA Goksin Bakir Yage Ltd.

Similar presentations


Presentation on theme: "Sofia, Bulgaria | 9-10 October ASP.NET: Developing Portal UI With Web Parts Goksin Bakir Yage Ltd Microsoft Regional Director, MEA Goksin Bakir Yage Ltd."— Presentation transcript:

1 Sofia, Bulgaria | 9-10 October ASP.NET: Developing Portal UI With Web Parts Goksin Bakir Yage Ltd Microsoft Regional Director, MEA Goksin Bakir Yage Ltd Microsoft Regional Director, MEA

2 Sofia, Bulgaria | 9-10 October Agenda ●Web Part Lifecycle ●Extending Personalization ●Connections ●Securing your Infrastructure ●Managing Personalized Data ●Web Part Lifecycle ●Extending Personalization ●Connections ●Securing your Infrastructure ●Managing Personalized Data

3 Sofia, Bulgaria | 9-10 October Components ●WebPartManager ●WebPartZones and Web Parts ●CatalogZones and CatalogParts ●EditorZones and EditorParts ●Web Part connections ●Web Part personalization ●Custom Web Parts ●WebPartManager ●WebPartZones and Web Parts ●CatalogZones and CatalogParts ●EditorZones and EditorParts ●Web Part connections ●Web Part personalization ●Custom Web Parts

4 Sofia, Bulgaria | 9-10 October Web Parts ●Framework for building portal-style apps ●Patterned after SharePoint Portal Server ●System.Web.UI.WebControls.WebParts ●Rich UIs with minimal code ●Edit page layout using drag-and-drop ●Edit appearance and behavior and more ●Seamless personalization ●Intercommunication ("connections") ●Framework for building portal-style apps ●Patterned after SharePoint Portal Server ●System.Web.UI.WebControls.WebParts ●Rich UIs with minimal code ●Edit page layout using drag-and-drop ●Edit appearance and behavior and more ●Seamless personalization ●Intercommunication ("connections")

5 Sofia, Bulgaria | 9-10 October The WebPartManager Control ●Orchestrates operation of Web Parts ●Maintains list of Web Parts and zones ●Manages page state (e.g., display mode) and fires events when page state changes ●Facilitates communication between Web Parts ●Manages personalization and much more ●One instance per page; no UI ●Orchestrates operation of Web Parts ●Maintains list of Web Parts and zones ●Manages page state (e.g., display mode) and fires events when page state changes ●Facilitates communication between Web Parts ●Manages personalization and much more ●One instance per page; no UI

6 Sofia, Bulgaria | 9-10 October The WebPartZone Control ●Defines zones on a Web Parts page ●Defines default layout and appearance of Web Parts within each zone ●Defines zones on a Web Parts page ●Defines default layout and appearance of Web Parts within each zone <asp:WebPartZone ID="WeatherZone" RunAt="server" DragHighlightColor="244,198,96" RunAt="server">

7 Sofia, Bulgaria | 9-10 October Web Part Zones Zone 1Zone 2

8 Sofia, Bulgaria | 9-10 October Web Part Chrome ●Title bar and border surrounding Web Part ●Look defined by WebPartZone properties ●Title bar and border surrounding Web Part ●Look defined by WebPartZone properties Title BarMinimize VerbClose Verb Verbs MenuBorder Verbs Button

9 Sofia, Bulgaria | 9-10 October Web Parts ●Controls defined in a WebPartZone ●Web controls, user controls, custom controls ●Controls that don't implement IWebPart are internally wrapped in GenericWebParts ●Adds properties: Title, Description, etc. ●Controls defined in a WebPartZone ●Web controls, user controls, custom controls ●Controls that don't implement IWebPart are internally wrapped in GenericWebParts ●Adds properties: Title, Description, etc.

10 Sofia, Bulgaria | 9-10 October Web Parts Search Web Part Stocks Web Part News Web Part Weather Web Part Calendar Web Part

11 Sofia, Bulgaria | 9-10 October Web Parts

12 Sofia, Bulgaria | 9-10 October Know The Web Part Life Cycle To Do The Right Thing At The Right Time

13 Sofia, Bulgaria | 9-10 October ●PreInit ●Init ●InitComplete ●LoadViewState ●Load ●LoadComplete ●PreRender ●SaveStateComplete ●Render ●PreInit ●Init ●InitComplete ●LoadViewState ●Load ●LoadComplete ●PreRender ●SaveStateComplete ●Render Web Part Lifecycle ●WebZones register with the WebPartManager ●Static WebParts are loaded ●Dynamic WebParts and connections are loaded ●Personalization data applied to Web Pars ●Web Part connections are activated ●Extract & save personalization data

14 Sofia, Bulgaria | 9-10 October Web Part Lifecycle Common developer scenarios ActionAfterBeforeSuggested Add WebZoneWebPartManager initialized Personalization data is applied Page.Init Add Static Web PartZones registeredPersonalization data is applied Page.Init Add Dynamic Web Part Personalization data is applied Personalization data is saved Add ConnectionsDynamic Web Part loaded Connections are activated Page.InitComplete Page.Load

15 Sofia, Bulgaria | 9-10 October Externally Defined Web Parts And Connections

16 Sofia, Bulgaria | 9-10 October Web Parts Personalization Is Extensible At Many Levels

17 Sofia, Bulgaria | 9-10 October Extending Personalization Override existing providers ●Implement custom load and save logic ●Encryption, query string, caching ●Use the data store from the base class ●Existing providers ●SQL Personalization Provider in the box ●Access provider available via the Web ●Implement custom load and save logic ●Encryption, query string, caching ●Use the data store from the base class ●Existing providers ●SQL Personalization Provider in the box ●Access provider available via the Web protected override void LoadPersonalizationBlobs(...) { // custom logic here (i.e. decrypt data) // custom logic here (i.e. decrypt data) base.LoadPersonalizationBlobs(..) base.LoadPersonalizationBlobs(..)} protected override void SavePersonalizationBlob(...) { // custom logic here (i.e. encrypt data) // custom logic here (i.e. encrypt data) base.SavePersonalizationBlob(..) base.SavePersonalizationBlob(..)}

18 Sofia, Bulgaria | 9-10 October Extending Personalization Override provider base class ●Support different data store ●Web Service, XML, Oracle ●Integrate to an existing application ●Only need to manage the storage of the personalization blob ●Support different data store ●Web Service, XML, Oracle ●Integrate to an existing application ●Only need to manage the storage of the personalization blob public abstract class PersonalizationProvider : ProviderBase { protected abstract void LoadPersonalizationBlobs(...); protected abstract void LoadPersonalizationBlobs(...); protected abstract void SavePersonalizationBlob(...); protected abstract void SavePersonalizationBlob(...); public abstract int ResetState(...); public abstract int ResetState(...); public abstract PersonalizationStateInfoCollection FindState(...); public abstract PersonalizationStateInfoCollection FindState(...);}

19 Sofia, Bulgaria | 9-10 October Extending Personalization Override personalization engine ●Take ownership of the personalization process ●Save and restore personalizable property values (diff & merge) ●Supporting the personalization Interfaces ●Track Web Part dirty state ●Use when previous options do not work ●Take ownership of the personalization process ●Save and restore personalizable property values (diff & merge) ●Supporting the personalization Interfaces ●Track Web Part dirty state ●Use when previous options do not work public class WebPartPersonalization { protected virtual PersonalizationScope Load(); protected virtual PersonalizationScope Load(); protected virtual void ApplyPersonalizationState(WebPart webPart); protected virtual void ApplyPersonalizationState(WebPart webPart); protected virtual void ExtractPersonalizationState(WebPart webPart); protected virtual void ExtractPersonalizationState(WebPart webPart); protected virtual void Save(); protected virtual void Save();} Extending Personalization Override personalization engine

20 Sofia, Bulgaria | 9-10 October Creating A Web Site Content Management Application

21 Sofia, Bulgaria | 9-10 October Changing Connection Behavior At Runtime

22 Sofia, Bulgaria | 9-10 October Connections Disable connection point ●Must be defined at compile time but can be disabled at runtime ●Can not create new connections ●Existing connections will display an error ●Must be defined at compile time but can be disabled at runtime ●Can not create new connections ●Existing connections will display an error public class SampleConsumer : WebPart { [ConnectionConsumerAttribute(“Data”, typeof(ExtendedConnectionPoint))] [ConnectionConsumerAttribute(“Data”, typeof(ExtendedConnectionPoint))] public void GetProviderInterface(ProviderInterface provider); public void GetProviderInterface(ProviderInterface provider);} public class ExtendedConnectionPoint : ConsumerConnectionPoint { public override bool GetEnabled(Control control) { public override bool GetEnabled(Control control) { // enable logic here (i.e. disable if SQL Server is down) // enable logic here (i.e. disable if SQL Server is down) }}

23 Sofia, Bulgaria | 9-10 October

24 Providing Rich Information Via Connections

25 Sofia, Bulgaria | 9-10 October Portals Have Unique Security Considerations

26 Sofia, Bulgaria | 9-10 October Securing Your Infrastructure Restrict contents of uploaded page ●Use the PageParserFilter feature ●Disallow code ●Restrict server controls ●Limit the number of controls on the page ●Enforce page base type and page directives ●All checks are performed at parse time ●Use the PageParserFilter feature ●Disallow code ●Restrict server controls ●Limit the number of controls on the page ●Enforce page base type and page directives ●All checks are performed at parse time public abstract class PageParserFilter { public virtual bool AllowCode { get; } public virtual bool AllowCode { get; } public virtual bool AllowControl(Type controlType, ControlBuilder builder); public virtual bool AllowControl(Type controlType, ControlBuilder builder); public virtual int NumberOfControlsAllowed { get; } public virtual int NumberOfControlsAllowed { get; } public virtual bool AllowBaseType(Type baseType); public virtual bool AllowBaseType(Type baseType); public virtual void PreprocessDirective(string name, IDictionary attributes); public virtual void PreprocessDirective(string name, IDictionary attributes);}

27 Sofia, Bulgaria | 9-10 October Securing Your Infrastructure Restrict Web Parts at runtime ●Based on the Web Part type and/or AuthorizationFilter property ●Example : Filter by user role ●Applies to all web parts on the page ●The personalized data is not disposed ●Subscribe to AuthorizeWebPart event or override IsAuthorized method ●Based on the Web Part type and/or AuthorizationFilter property ●Example : Filter by user role ●Applies to all web parts on the page ●The personalized data is not disposed ●Subscribe to AuthorizeWebPart event or override IsAuthorized method public abstract class WebPartManager { public virtual bool IsAuthorized(Type type, string path, public virtual bool IsAuthorized(Type type, string path, string authorizationFilter, bool isShared); string authorizationFilter, bool isShared); }

28 Sofia, Bulgaria | 9-10 October

29 Implementing Secure Import/Export

30 Sofia, Bulgaria | 9-10 October Portal Users Need Self Management Tools

31 Sofia, Bulgaria | 9-10 October Managing Personalized Data Page level ●PersonalizationAdministration class ●High level APIs to manage all data ●Works at the page level, not web part level ●Works with any Personalization Provider ●Self management tool must enforce security ●PersonalizationAdministration class ●High level APIs to manage all data ●Works at the page level, not web part level ●Works with any Personalization Provider ●Self management tool must enforce security public static class PersonalizationAdministration { public static int GetCountOfUserState(string usernameToMatch); public static int GetCountOfUserState(string usernameToMatch); public static PersonalizationStateInfoCollection FindUserState ( public static PersonalizationStateInfoCollection FindUserState ( string pathToMatch, string usernameToMatch); string pathToMatch, string usernameToMatch); public static bool ResetUserState(string path, string username); public static bool ResetUserState(string path, string username); public static int ResetInactiveUserState(DateTime userInactiveSinceDate); public static int ResetInactiveUserState(DateTime userInactiveSinceDate);}

32 Sofia, Bulgaria | 9-10 October Managing Personalized Data Web Part level ●Run target page within management page ●Attach to an event in the target page ●Based on Web Part lifecycle ●Execute code within event handler ●Example: call WebPartManager APIs like DeleteWebPart() or CloseWebPart() ●Target page will save personalized data ●Run target page within management page ●Attach to an event in the target page ●Based on Web Part lifecycle ●Execute code within event handler ●Example: call WebPartManager APIs like DeleteWebPart() or CloseWebPart() ●Target page will save personalized data

33 Sofia, Bulgaria | 9-10 October Creating An Admin Page

34 Sofia, Bulgaria | 9-10 October Call To Action ●Use Web Part control to empower user customization of their site ●Work with the Web Part Lifecycle ●Use the Web Part control set when building Module User Interfaces ●Use Web Part control to empower user customization of their site ●Work with the Web Part Lifecycle ●Use the Web Part control set when building Module User Interfaces

35 Sofia, Bulgaria | 9-10 October Community Resources ●INETA MEA ! ●www.ineta.org ●mea.ineta.org ●ASP.NET Web Site - http://www.asp.nethttp://www.asp.net ●MSDN dev center - http://msdn.microsoft.com/asp.net/ http://msdn.microsoft.com/asp.net/ ●ASP.NT Forums - http://forums.asp.net/145/ShowForum.aspx http://forums.asp.net/145/ShowForum.aspx ●Channel 9 tag - http://channel9.msdn.com/tags/ASP.NET http://channel9.msdn.com/tags/ASP.NET ●INETA MEA ! ●www.ineta.org ●mea.ineta.org ●ASP.NET Web Site - http://www.asp.nethttp://www.asp.net ●MSDN dev center - http://msdn.microsoft.com/asp.net/ http://msdn.microsoft.com/asp.net/ ●ASP.NT Forums - http://forums.asp.net/145/ShowForum.aspx http://forums.asp.net/145/ShowForum.aspx ●Channel 9 tag - http://channel9.msdn.com/tags/ASP.NET http://channel9.msdn.com/tags/ASP.NET

36 Sofia, Bulgaria | 9-10 October Call To Action ●Use Web Part control to empower user customization of their site ●Work with the Web Part Lifecycle ●Use the Web Part control set when building Module User Interfaces ●Use Web Part control to empower user customization of their site ●Work with the Web Part Lifecycle ●Use the Web Part control set when building Module User Interfaces

37 Sofia, Bulgaria | 9-10 October Community Resources ●INETA MEA ! ●www.ineta.org ●mea.ineta.org ●ASP.NET Web Site - http://www.asp.nethttp://www.asp.net ●MSDN dev center - http://msdn.microsoft.com/asp.net/ http://msdn.microsoft.com/asp.net/ ●ASP.NT Forums - http://forums.asp.net/145/ShowForum.asp x http://forums.asp.net/145/ShowForum.asp x ●Channel 9 tag - http://channel9.msdn.com/tags/ASP.NET http://channel9.msdn.com/tags/ASP.NET ●INETA MEA ! ●www.ineta.org ●mea.ineta.org ●ASP.NET Web Site - http://www.asp.nethttp://www.asp.net ●MSDN dev center - http://msdn.microsoft.com/asp.net/ http://msdn.microsoft.com/asp.net/ ●ASP.NT Forums - http://forums.asp.net/145/ShowForum.asp x http://forums.asp.net/145/ShowForum.asp x ●Channel 9 tag - http://channel9.msdn.com/tags/ASP.NET http://channel9.msdn.com/tags/ASP.NET

38 Sofia, Bulgaria | 9-10 October Please fill out the survey forms! They are the key to amazing prizes that you can get at the end of each day Thank you!

39 Sofia, Bulgaria | 9-10 October


Download ppt "Sofia, Bulgaria | 9-10 October ASP.NET: Developing Portal UI With Web Parts Goksin Bakir Yage Ltd Microsoft Regional Director, MEA Goksin Bakir Yage Ltd."

Similar presentations


Ads by Google