<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blog.avanadeadvisor.com/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Johan's Avanade Blog</title><link>http://blog.avanadeadvisor.com/blogs/johanr/default.aspx</link><description /><dc:language>en-US</dc:language><generator>CommunityServer 2.0 (Build: 60217.2664)</generator><item><title>Forms Authentication with Silverlight, ADAM, and AzMan</title><link>http://blog.avanadeadvisor.com/blogs/johanr/archive/2009/01/20/12373.aspx</link><pubDate>Tue, 20 Jan 2009 21:40:00 GMT</pubDate><guid isPermaLink="false">5e51d585-b788-4f7c-85ba-1877739ce145:12373</guid><dc:creator>johanr</dc:creator><slash:comments>0</slash:comments><comments>http://blog.avanadeadvisor.com/blogs/johanr/comments/12373.aspx</comments><wfw:commentRss>http://blog.avanadeadvisor.com/blogs/johanr/commentrss.aspx?PostID=12373</wfw:commentRss><description>&lt;p&gt;In this post, I describe how to implement Authentication and Authorization for Silverlight using AD LDS (previously known called ADAM), and the Authorization Manager (also known as AzMan).&lt;/p&gt;  &lt;p&gt;Here is the list of steps involved in this implementation:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Setup AS LDS &lt;/li&gt;    &lt;li&gt;Setup AzMan on AD LDS &lt;/li&gt;    &lt;li&gt;Implement a custom RoleProvider for AzMan &lt;/li&gt;    &lt;li&gt;Implement a custom Principal &lt;/li&gt;    &lt;li&gt;Implement a custom PrincipalPermission and PrincipalPermissionAttribute &lt;/li&gt;    &lt;li&gt;Implement a custom AuthorizationPolicy &lt;/li&gt;    &lt;li&gt;Implement a custom WCF Authorization Service &lt;/li&gt;    &lt;li&gt;Setup WCF Authentication, Role and Authorization Services &lt;/li&gt;    &lt;li&gt;Setup SSL &lt;/li&gt;    &lt;li&gt;Implement a custom Silverlight Principal and Identity &lt;/li&gt;    &lt;li&gt;Implement a workaround for Silverlight-enabled WCF Service Exception Handling &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Here is why I chose this implementation:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;I am using Silverlight 2 with VS2008 SP1 on WS2008, &lt;/li&gt;    &lt;li&gt;I am using Forms Authentication without Windows Credentials (for Internet users), &lt;/li&gt;    &lt;li&gt;I want to have a RBAC allowing me to define Operations (no Roles in code), &lt;/li&gt;    &lt;li&gt;I want to have the flexibility to use ADAM, and the eventual ability to move to Federated Services, &lt;/li&gt;    &lt;li&gt;Silverlight only works with basicHttpBinding (Geneva and Federated Serviced use wsFederationHttpBinding), &lt;/li&gt;    &lt;li&gt;AzMan only works with Windows Authentication out-of-the-box. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;strong&gt;Setup AD LDS&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The first step consists of installing Active Directory Lightweight Directory Services (AD LDS), previously called Active Directory Application Mode (ADAM). AD LDS is now directly included in the Roles of Windows Server 2008.&lt;/p&gt;  &lt;p&gt;Since, this installation is already well described in the following &lt;a href="http://community.bartdesmet.net/blogs/bart/archive/2008/07/26/using-active-directory-lightweight-directory-services-lds-in-windows-server-2008.aspx"&gt;link&lt;/a&gt;, I will only add a couple instructions to this for the purpose of this post.&lt;/p&gt;  &lt;p&gt;The following LDF files should be included in the installation:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;MS-AzMan.LDF &lt;/li&gt;    &lt;li&gt;MS-InetOrgPerson.LDF &lt;/li&gt;    &lt;li&gt;MS-User.LDF &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Once the installation completed, add the &amp;quot;NETWORK SERVICE&amp;quot; account to the &amp;quot;Administrators&amp;quot; roles:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Open ADSI Edit &lt;/li&gt;    &lt;li&gt;Connect to the newly created partition (&amp;quot;Select a well known Naming Context&amp;quot;) &lt;/li&gt;    &lt;li&gt;Expand Tree View up to &amp;quot;CN=Roles&amp;quot; &lt;/li&gt;    &lt;li&gt;Open &amp;quot;CN=Administrators&amp;quot; Properties &lt;/li&gt;    &lt;li&gt;Edit &amp;quot;member&amp;quot; property &lt;/li&gt;    &lt;li&gt;Add the &amp;quot;NETWORK SERVICE&amp;quot; Windows Account &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Furthermore, if you want to setup SSL, you can simply create a &amp;quot;Self-Signed Certificate&amp;quot; for development purpose in IIS7 (Server Certificates).&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Links:&lt;/u&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://community.bartdesmet.net/blogs/bart/archive/2008/07/26/using-active-directory-lightweight-directory-services-lds-in-windows-server-2008.aspx"&gt;Using Active Directory Lightweight Directory Services (LDS) in Windows Server 2008&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://erlend.oftedal.no/blog/?blogid=6"&gt;Making ADAM work with ASP.NET 2.0 on Windows XP&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Setup AzMan&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This second step consists of creating an Authorization Store in AD LDS for the Authorization Manager.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Run &amp;quot;azman.msc&amp;quot; &lt;/li&gt;    &lt;li&gt;Right click &amp;quot;Authorization Manager&amp;quot; &lt;/li&gt;    &lt;li&gt;Select &amp;quot;New Authorization Store&amp;quot;:      &lt;ul&gt;       &lt;li&gt;Select ADAM &lt;/li&gt;        &lt;li&gt;Schema version 2 &lt;/li&gt;        &lt;li&gt;Store name: msldap://localhost:389/CN=[user store name], [your AD LDS partition] &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;(*) Where [user store name] such as: MyUserStore &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Right click the new store (MyUserStore) &lt;/li&gt;    &lt;li&gt;Select &amp;quot;New Application&amp;quot; and create a new application (MyApplication) &lt;/li&gt;    &lt;li&gt;Open the new application Properties &lt;/li&gt;    &lt;li&gt;Open the Security tab and add the &amp;quot;NETWORK SERVICE&amp;quot; account to the Administrator role &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;From now, you can define your Operations, Tasks, and Roles.&lt;/p&gt;  &lt;p&gt;In the following &lt;a href="http://msdn.microsoft.com/en-us/library/ms998336.aspx"&gt;link&lt;/a&gt;, MSDN clearly define how to use the Authorization Manager with ASP.NET. However this implementation only uses ADAM as a repository. The users are authenticated with Windows Accounts!&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Links:&lt;/u&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms998336.aspx"&gt;How To: Use Authorization Manager (AzMan) with ASP.NET 2.0&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://erlend.oftedal.no/blog/?blogid=8"&gt;Using ADAM for Roles and Membership in ASP.NET 2.0&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Implement a custom RoleProvider for AzMan&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;At this stage we should have AD LDS and AzMan setup, however as indicated in the previous post, AzMan only works with Windows Authentication by default. So, we need to implement a custom RoleProvider to use it with Internet users authenticated by AD LDS.&lt;/p&gt;  &lt;p&gt;I have added 2 new methods to MyRoleProvider:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;public string[] GetOperationsForUser(string userName) &lt;/li&gt;    &lt;li&gt;public bool CanUserAccessOperation(string userName, string operationName) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Using the following links, and the Reflector on the AuthorizationStoreRoleProvider class, you can easily create your own provider.&lt;/p&gt;  &lt;p&gt;My 2 cents on this:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Check-out the CheckParameter() and CheckArrayParameter() methods in the AuthorizationStoreRoleProvider &lt;/li&gt;    &lt;li&gt;Don't forget to dispose all COM objects that have been opened. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;For this second point, I implemented my own internal AzManStore type as follow:&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;internal class AzManStore : IDisposable&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public AzAuthorizationStore Store { get; private set; }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public IAzApplication Application { get; private set; }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public AzManStore(string applicationName, string connectionString)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;if (string.IsNullOrEmpty(applicationName)) throw new AzManProviderException(&amp;quot;ApplicationNameNotSpecified&amp;quot;);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;try&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;this.Store = new AzAuthorizationStore();&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;this.Store.Initialize(0, connectionString, null);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;this.Application = this.Store.OpenApplication(applicationName, null);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;catch (COMException ex)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;throw new AzManProviderException(&amp;quot;InitializeFailed&amp;quot;, ex);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;catch (Exception ex)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;throw new AzManProviderException(&amp;quot;InvalidConnectionString&amp;quot;, ex);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public void Dispose()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;if (this.Application == null) return;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;Marshal.FinalReleaseComObject(this.Application);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;Marshal.FinalReleaseComObject(this.Store);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;this.Application = null;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;this.Store = null;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Then, I can open my AzMan application as follow:&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;using (var store = new AzManStore(this.ApplicationName, this.ConnectionString))&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;var roles = store.Application.Roles;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;// do something&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Once this new RoleProvider created, you can sign you DLL, put it in the GAC, add the new Provider to the trusted list, and setup your Web Application (Silverlight Web Application Host) to enable Authentication and Authorization.&lt;/p&gt;  &lt;p&gt;To add the new provider to the trusted list, open and edit the Administration.config file located in: &lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;C:\Windows\System32\inetsrv\config&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Here are the lines to add to your web.config, however you should be able to setup everything from IIS7:&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;&amp;lt; name=&amp;quot;MyMembershipProvider&amp;quot;&amp;gt;&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;type=&amp;quot;System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&amp;quot; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;connectionStringName=&amp;quot;MyAdamConnectionString&amp;quot; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;connectionProtection=&amp;quot;Secure&amp;quot; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;applicationName=&amp;quot;MyApplication&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;enableSearchMethods=&amp;quot;true&amp;quot; /&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;&amp;lt; name=&amp;quot;MyRoleProvider&amp;quot;&amp;gt;&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;type=&amp;quot;MyLibrary.MyRoleProvider, MyLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1111111111&amp;quot; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;connectionStringName=&amp;quot;MyAzManConnectionString&amp;quot; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;applicationName=&amp;quot;MyApplication&amp;quot; /&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="ta"&gt;At this point, you should be able to setup your users and roles directly from IIS7, or from the ASP.NET Configuration site!&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font color="#000000" face="ta"&gt;Links:&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://erlend.oftedal.no/blog/?blogid=8"&gt;&lt;font face="Tahoma"&gt;Using ADAM for Roles and Membership in ASP.NET 2.0&lt;/font&gt;&lt;/a&gt;&lt;font face="Tahoma"&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/azman/archive/2006/05/06/591230.aspx"&gt;&lt;font face="Tahoma"&gt;Using ADAM Principals in Authorization Manager&lt;/font&gt;&lt;/a&gt;&lt;font face="Tahoma"&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.derkeiler.com/Newsgroups/microsoft.public.dotnet.framework.aspnet.security/2006-03/msg00348.html"&gt;&lt;font face="Tahoma"&gt;ADAM and AuthorizationStoreRoleProvider&lt;/font&gt;&lt;/a&gt;&lt;font face="Tahoma"&gt; &lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#000000" face="Tahoma"&gt;Implement a custom Principal&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;In this step, I propose to create a custom Principal that will be used on the Server. This Principal will allow to directly access the Operations accessible by the Identity.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public class MyPrincipal : IPrincipal&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;private IIdentity _identity = null;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;private string[] _operations = null;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public IIdentity Identity { get { return this._identity; } }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public MyPrincipal(IIdentity identity, string[] operations)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;this._identity = identity;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;this._operations = operations;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public bool IsInRole(string role)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;throw new NotImplementedException();&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public bool HasRequiredOperations(string[] requiredOperations)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;if (requiredOperations == null) return true;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;if (this._operations == null) return false;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;var hasOperations = true;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;foreach (var operation in requiredOperations)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;if (this._operations.Contains(operation) == false)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;hasOperations = false;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;break;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;return hasOperations;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Links:&lt;/u&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.theserverside.net/tt/articles/showarticle.tss?id=ClaimsBasedSecurityModel2"&gt;&lt;font face="Tahoma"&gt;Building a Claims-Based Security Model in WCF - Part 2&lt;/font&gt;&lt;/a&gt;&lt;font color="#ff5c00" face="Tahoma"&gt; &lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#000000" face="Tahoma"&gt;Implement a custom PrincipalPermission and PrincipalPermissionAttribute&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;Now that our Principal is created, we can create a custom PrincipalPermission and its PrincipalPermissionAttribute. The following &lt;/font&gt;&lt;a href="http://www.theserverside.net/tt/articles/showarticle.tss?id=ClaimsBasedSecurityModel2"&gt;&lt;font color="#000000" face="Tahoma"&gt;link&lt;/font&gt;&lt;/a&gt;&lt;font color="#000000" face="Tahoma"&gt; clearly explains how to implement these classes for a claim-based scenario. So, instead of a CheckClaims() method, you can write a CheckOperations() method and invoke the principal.HasRequiredOperation() method.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;As described in the link, this allows the use of declarative and imperative security checks as follow:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;[MyPrincipalPermission(SecurityAction.Demand, Operation = &amp;quot;MyOperation&amp;quot;)]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public void MyOperation()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;// do something&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;Or&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public void MyOperation()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;var permission = new MyPrincipalPermission(&amp;quot;MyOperation&amp;quot;);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;Permission.Demand();&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;// do something&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;I particularly like this implementation, because it allows decoupling the code from the RBAC used, and the type of authentication. In this scenario I am using AzMan with a &amp;quot;standard Role-Based&amp;quot; approach, but it should not be too hard to move to the &amp;quot;Claim-Based&amp;quot; model if needed.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font color="#000000" face="Tahoma"&gt;Links:&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.theserverside.net/tt/articles/showarticle.tss?id=ClaimsBasedSecurityModel2"&gt;&lt;font face="Tahoma"&gt;Building a Claims-Based Security Model in WCF - Part 2&lt;/font&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#000000" face="Tahoma"&gt;Implement a custom AuthorizationPolicy&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;This step consists of creating a custom AuthorizationPolicy that will tie the things together! The AuthorizationPolicy will allow to initialize the CurrentPrincipal of the current Thread whenever a WCF Service is invoked.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public class MyAuthorizationPolicy : IAuthorizationPolicy&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;private Guid _id = Guid.NewGuid();&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public string Id { get { return this._id.ToString(); } }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public ClaimSet Issuer { get { return ClaimSet.System; } }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public bool Evaluate(EvaluationContext evaluationContext, ref object state)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;IIdentity identity = this.GetClientIdentity(evaluationContext);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;var provider = (MyRoleProvider)Roles.Provider;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;var operations = provider.GetOperationsForUser(identity.Name);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;evaluationContext.Properties[&amp;quot;Principal&amp;quot;] = new MyPrincipal(identity, operations);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;return true;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;private IIdentity GetClientIdentity(EvaluationContext evaluationContext)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;var identity = HttpContext.Current.User.Identity;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;if (identity == null)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;throw new SecurityException(&amp;quot;NoIdentityFound&amp;quot;);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;return identity;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;You can notice in this code the reuse of MyRoleProvider created in step# 3, and MyPrincipal created in step# 4.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;Then, the following lines should be added to the behavior of your WCF Service (or Silverlight-enabled WCF Service):&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font color="#000000" face="Tahoma"&gt;Links:&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.leastprivilege.com/CustomPrincipalsAndWCF.aspx"&gt;&lt;font face="Tahoma"&gt;Custom Principals and WCF&lt;/font&gt;&lt;/a&gt;&lt;font face="Tahoma"&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.theserverside.net/tt/articles/showarticle.tss?id=ClaimsBasedSecurityModel2"&gt;&lt;font face="Tahoma"&gt;Building a Claims-Based Security Model in WCF - Part 2&lt;/font&gt;&lt;/a&gt;&lt;font face="Tahoma"&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.codeplex.com/WCFSecurityGuide/Wiki/View.aspx?title=How%20To%20-%20Use%20Username%20Authentication%20with%20Transport%20Security%20in%20WCF%20from%20Windows%20Forms&amp;amp;referringTitle=Home"&gt;&lt;font face="Tahoma"&gt;How To â Use Username Authentication with Transport Security in WCF from Windows Forms&lt;/font&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#000000" face="Tahoma"&gt;Implement a custom WCF Authorization Service&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;The last step left on the server side is to implement a new WCF Service to expose the following methods:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font color="#000000" face="Tahoma"&gt;public string[] GetOperationsForCurrentUser() &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font color="#000000" face="Tahoma"&gt;public bool CanCurrentUserAccessOperation(string operation) &lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;These 2 methods will allow the Silverlight application to retrieve the Operations accessible by a user, and then initialize the Silverlight Identity and Principal context.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;Here again, you can use the Reflector on the System.Web.ApplicationServices.RoleService class, and rename the Role methods by the Operation methods...&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#000000" face="Tahoma"&gt;Setup WCF Authentication, Role and Authorization Services&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;Now that all Authentication, Role and Authorization Services are ready to be used, you can set them up for your Silverlight application.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font color="#000000" face="Tahoma"&gt;Links:&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb398990.aspx"&gt;&lt;font face="Tahoma"&gt;How to: Enable the WCF Authentication Service&lt;/font&gt;&lt;/a&gt;&lt;font color="#ff5c00" face="Tahoma"&gt; &lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;Note: It is highly recommended to secure these services with SSL.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#000000" face="Tahoma"&gt;Setup SSL&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;The following link describes how to enable SSL on your application. This is highly recommended to secure your application.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font color="#000000" face="Tahoma"&gt;Links:&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://learn.iis.net/page.aspx/144/how-to-setup-ssl-on-iis-7/"&gt;&lt;font face="Tahoma"&gt;How to Setup SSL on IIS 7.0&lt;/font&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://technet.microsoft.com/en-us/library/cc725767.aspx" target="_blank"&gt;Configuring LDAP over SSL Requirements for AD LDS&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#000000" face="Tahoma"&gt;Implement a custom Silverlight Principal and Identity&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;We are almost there! At this stage, everything is ready on the Server, however on the client side there is no Identity and Principal implemented in Silverlight. Fortunately, the IIdentity and IPrincipal interfaces are exposed. So, you can create your custom classes.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;For this part, I have decided to go for a solution with a SilverlightIdentity and a SilverlightPrincipal as proposed in this &lt;/font&gt;&lt;a href="http://www.myblogon.net/archive/2008/05/22/creating-a-custom-principal-and-identity-for-silverlight-2.aspx"&gt;&lt;font face="Tahoma"&gt;link&lt;/font&gt;&lt;/a&gt;&lt;font color="#000000" face="Tahoma"&gt;. I have added a CanAccessOperation(string operation) method to allow the Silverlight application to check if a user has access to an Operation.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;The SilverlightIdentity and SilverlightPrincipal classes are initialized using the Authentication, Role, and Authorization WCF Services previously added to the Web Application (host) for this purpose. So, they need to be referenced in the Silverlight project.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font color="#000000" face="Tahoma"&gt;Links:&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.myblogon.net/archive/2008/05/22/creating-a-custom-principal-and-identity-for-silverlight-2.aspx"&gt;&lt;font face="Tahoma"&gt;Creating a custom Principal and Identity for Silverlight 2&lt;/font&gt;&lt;/a&gt;&lt;font face="Tahoma"&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/brada/archive/2008/05/03/accessing-the-asp-net-authentication-profile-and-role-service-in-silverlight.aspx"&gt;&lt;font face="Tahoma"&gt;Accessing the ASP.NET Authentication, Profile and Role Service in Silverlight&lt;/font&gt;&lt;/a&gt;&lt;font face="Tahoma"&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/brada/archive/2008/06/08/silverlight-roles-profile-and-authentication-example-updated-for-silverlight-beta2-now-with-visual-state-manager-vsm-goodness.aspx"&gt;&lt;font face="Tahoma"&gt;Silverlight Roles, Profile and Authentication Example Updated for Silverlight Beta2&lt;/font&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#000000" face="Tahoma"&gt;Implement a workaround for Silverlight-enabled WCF Service Exception Handling&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;WCF comes with the FaultException class to provide a clean solution to exchange error details between Client and Server. However, up to now Silverlight does not work properly with this solution. An error 404 Not Found is returned!&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;You will find several solutions to this (refer to links), and here is mine. Add the following classes to the Web Application exposing your Silverlight-enabled WCF Services:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;[DataContract]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;[KnownType(typeof(MyResult))]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public class ResponseData&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;[DataMember]public Error Error { get; private set; }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;[DataMember]public object Data { get; private set; }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public ResponseData(Exception ex)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;this.Error = new Error()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;Type = ex.GetType().Name,&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;Message = ex.Message&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;};&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public ResponseData(object data)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;this.Data = data;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;[DataContract]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public class Error&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;[DataMember]public string Type { get; set; }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;[DataMember]public string Message { get; set; }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;Add the type of your result to the ResponseData using the KnownType attribute. This allows the Service Utility to generate your classes with the proxy.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;Then, use it to return your result to Silverlight:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;[OperationContract]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;public ResponseData MyOperation()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;try&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;var result = new MyResult(&amp;quot;Hello world!&amp;quot;);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;return new ResponseData(result);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;catch (Exception ex)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;return new ResponseData(ex);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font color="#000000" face="Tahoma"&gt;Links:&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://silverlight.net/forums/t/17944.aspx"&gt;&lt;font face="Tahoma"&gt;WCF Services with faultexception&lt;/font&gt;&lt;/a&gt;&lt;font face="Tahoma"&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://silverlight.net/forums/p/19875/94861.aspx#94861"&gt;&lt;font face="Tahoma"&gt;Getting the actual Exception thrown from a WebService&lt;/font&gt;&lt;/a&gt;&lt;font face="Tahoma"&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.netfxharmonics.com/2008/11/Understanding-WCF-Services-in-Silverlight-2#WCFSilverlightHandlingFaults"&gt;&lt;font face="Tahoma"&gt;Understanding WCF Services in Silverlight 2&lt;/font&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#000000" face="Tahoma"&gt;Wrap-Up&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000" face="Tahoma"&gt;Silverlight can be setup to use Forms Authentication and WCF Authentication &amp;amp; Role Services.&amp;#160; In this post, I proposed an implementation combining AD LDS and the Authorization Manager.&amp;#160; This allows Web Applications dedicated to Internet Users to benefit from the standard Administration tools (ADAM and AzMan), and also decouple the Application from these Administration tools.&lt;/font&gt;&lt;/p&gt;  &lt;div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:6cd54cb9-e1c1-4da8-b7ec-a6613d44b896" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Silverlight+2" rel="tag"&gt;Silverlight 2&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ADAM" rel="tag"&gt;ADAM&lt;/a&gt;,&lt;a href="http://technorati.com/tags/AD+LDS" rel="tag"&gt;AD LDS&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Authorization+Manager" rel="tag"&gt;Authorization Manager&lt;/a&gt;,&lt;a href="http://technorati.com/tags/AzMan" rel="tag"&gt;AzMan&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Windows+Server+2008" rel="tag"&gt;Windows Server 2008&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Visual+Studio+2008" rel="tag"&gt;Visual Studio 2008&lt;/a&gt;,&lt;a href="http://technorati.com/tags/IIS7" rel="tag"&gt;IIS7&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Forms+Authentication" rel="tag"&gt;Forms Authentication&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blog.avanadeadvisor.com/aggbug.aspx?PostID=12373" width="1" height="1"&gt;</description></item><item><title>ADO.NET Data Services: how to invoke a WebGet service operation from a WebClient</title><link>http://blog.avanadeadvisor.com/blogs/johanr/archive/2008/10/16/11973.aspx</link><pubDate>Thu, 16 Oct 2008 15:49:47 GMT</pubDate><guid isPermaLink="false">5e51d585-b788-4f7c-85ba-1877739ce145:11973</guid><dc:creator>johanr</dc:creator><slash:comments>0</slash:comments><comments>http://blog.avanadeadvisor.com/blogs/johanr/comments/11973.aspx</comments><wfw:commentRss>http://blog.avanadeadvisor.com/blogs/johanr/commentrss.aspx?PostID=11973</wfw:commentRss><description>&lt;p&gt;I have been working lately with ADO.NET Data Services, and I found several tutorials on how to create your first services and service operations.&amp;#160; But, then once I wanted to consume my service operations (WebGet), I was in the clouds...&lt;/p&gt;  &lt;p&gt;So, here are my 2 cents...&lt;/p&gt;  &lt;p&gt;First, here is the context of the service operation on the server:&lt;/p&gt;  &lt;p&gt;public class MyService : DataService&amp;lt;MyEntities&amp;gt;   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // This method is called only once to initialize service-wide policies.    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public static void InitializeService(IDataServiceConfiguration config)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; config.SetServiceOperationAccessRule(&amp;quot;*&amp;quot;, ServiceOperationRights.All);    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [WebGet]   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public IQueryable&amp;lt;Program&amp;gt; GetPrograms(int code, DateTime startDate, DateTime endDate)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return from program in this.CurrentDataSource.Program    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; where program.Code == code    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;amp;&amp;amp; program.Date &amp;gt;= startDate.Date    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;amp;&amp;amp; program.Date &amp;lt; endDate.Date    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; select program;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt; }  &lt;p&gt;Then, on the client I can invoke it as follow:&lt;/p&gt;  &lt;p&gt;public IList&amp;lt;Program&amp;gt; Retrieve(int code, DateTime startDate, DateTime endDate)   &lt;br /&gt;{&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; var context = new MyService.MyEntities(&amp;lt;service url&amp;gt;);    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; context.MergeOption = MergeOption.AppendOnly;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; var list = context.CreateQuery&amp;lt;Program&amp;gt;(&amp;quot;GetPrograms&amp;quot;)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .AddQueryOption(&amp;quot;code&amp;quot;, code)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .AddQueryOption(&amp;quot;startDate&amp;quot;, string.Format(&amp;quot;datetime'{0:yyyy-MM-ddTHH:mm:ss}'&amp;quot;, startDate))    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .AddQueryOption(&amp;quot;endDate&amp;quot;, string.Format(&amp;quot;datetime'{0:yyyy-MM-ddTHH:mm:ss}'&amp;quot;, endDate)); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return list.ToList();   &lt;br /&gt;}&lt;/p&gt;  &lt;p&gt;Note that the parameters must be added inline to the CreateQuery method, and I had to use specific DateTime format for my parameters.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Links&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/magazine/cc794279.aspx" target="_blank"&gt;Create Data-Centric Web Applications With Silverlight 2&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/12/12/ado-net-data-services-part-1-building-a-simple-web-data-service.aspx" target="_blank"&gt;ADO.Net Data Services Part 1 - Building a Simple Web Data Service&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/12/16/ado-net-data-services-part-2-using-service-operations-with-webget.aspx" target="_blank"&gt;ADO.Net Data Services Part 2 - Using Service Operations with WebGet&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/marcelolr/archive/2008/01/21/service-operations-in-ado-net-data-services.aspx" target="_blank"&gt;Service Operations in ADO.NET Data Services&lt;/a&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f9f1a75c-415e-4ca3-af1d-b34a44c84701"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/ADO.NET%20Data%20Services" rel="tag"&gt;ADO.NET Data Services&lt;/a&gt;,&lt;a href="http://technorati.com/tags/WebGet" rel="tag"&gt;WebGet&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Service%20Operation" rel="tag"&gt;Service Operation&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blog.avanadeadvisor.com/aggbug.aspx?PostID=11973" width="1" height="1"&gt;</description></item><item><title>Silverlight Debugger suddenly stopped working!</title><link>http://blog.avanadeadvisor.com/blogs/johanr/archive/2008/09/17/11715.aspx</link><pubDate>Wed, 17 Sep 2008 15:59:00 GMT</pubDate><guid isPermaLink="false">5e51d585-b788-4f7c-85ba-1877739ce145:11715</guid><dc:creator>johanr</dc:creator><slash:comments>0</slash:comments><comments>http://blog.avanadeadvisor.com/blogs/johanr/comments/11715.aspx</comments><wfw:commentRss>http://blog.avanadeadvisor.com/blogs/johanr/commentrss.aspx?PostID=11715</wfw:commentRss><description>&lt;P&gt;I have been working on a Silverlight app (using VS2008 and Blend June Preview), and I first noticed that, sometimes, when I ran my app I did not have the latest code, so I stopped, rebuilt, and restarted the app and it usually worked.&lt;/P&gt;
&lt;P&gt;But this week, I have been blocked for an hour when my Debugger suddenly stopped working.&amp;nbsp; I thought the changes I made introduced strange behaviors causing the ASP.NET Development Server to stop.&amp;nbsp; Then, I realized that for some reasons my latest code was not cached anymore by IE!&lt;/P&gt;
&lt;P&gt;So, if your Silverlight app does not appear with your latest changes, or if your Debugger suddenly stops working, clear the "Temporary Internet Files" in IE ("Tools\Delete Browsing History..." menu).&lt;/P&gt;
&lt;P&gt;UPDATE&lt;/P&gt;
&lt;P&gt;Since this also happens when I update the structure of my solution (moving project in sub-folders, etc.), I also need to check the Properties of my Web Application.&amp;nbsp; The "Silverlight" CheckBox should be checked under Web / Debuggers.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Links:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://silverlight.net/forums/p/12923/92392.aspx" target=_blank&gt;Silverlight.net Forum - Debugger stopped working&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://silverlight.net/forums/p/15942/52665.aspx" target=_blank&gt;Silverlight.net Forum - aspx file not displaying the last .xap build&lt;/A&gt;&lt;/P&gt;
&lt;DIV class=wlWriterSmartContent id=scid:0767317B-992E-4b12-91E0-4F059A8CECA8:3f20ce52-e024-45d2-9d75-301bc06144d4&gt;Technorati Tags: &lt;A href="http://technorati.com/tags/Silverlight" rel=tag&gt;Silverlight&lt;/A&gt;,&lt;A href="http://technorati.com/tags/IE" rel=tag&gt;IE&lt;/A&gt;,&lt;A href="http://technorati.com/tags/ASP.NET%20Development%20Server" rel=tag&gt;ASP.NET Development Server&lt;/A&gt;,&lt;A href="http://technorati.com/tags/Debugger" rel=tag&gt;Debugger&lt;/A&gt;&lt;/DIV&gt;&lt;img src="http://blog.avanadeadvisor.com/aggbug.aspx?PostID=11715" width="1" height="1"&gt;</description></item><item><title>showModalDialog and PostBack</title><link>http://blog.avanadeadvisor.com/blogs/johanr/archive/2008/06/20/11369.aspx</link><pubDate>Fri, 20 Jun 2008 10:08:54 GMT</pubDate><guid isPermaLink="false">5e51d585-b788-4f7c-85ba-1877739ce145:11369</guid><dc:creator>johanr</dc:creator><slash:comments>0</slash:comments><comments>http://blog.avanadeadvisor.com/blogs/johanr/comments/11369.aspx</comments><wfw:commentRss>http://blog.avanadeadvisor.com/blogs/johanr/commentrss.aspx?PostID=11369</wfw:commentRss><description>&lt;p&gt;Working on a MOSS component, I implemented a Modal Popup form including a SPGridView with Sorting an Filtering features.&amp;#160; unfortunately, I spent &amp;quot;huge&amp;quot; amount of time figuring-out how to make the grid working properly with its PostBack events.&amp;#160; The main issue was every javascript call resulted in the opening of a new form...&lt;/p&gt;  &lt;p&gt;I found a bunch of posts regarding this, and the main advice was to avoid using the showModalDialog for non-static content.&amp;#160; Just use the window.open()...&lt;/p&gt;  &lt;p&gt;I finally found this &lt;a href="http://www.themssforum.com/Asp/Postback-issues-466795/" target="_blank"&gt;post&lt;/a&gt;.&amp;#160; The result was to add the following line to the &amp;lt;head&amp;gt; tag of my popup form:&lt;/p&gt;  &lt;p&gt;&amp;lt;base target=&amp;quot;_self&amp;quot;/&amp;gt;&lt;/p&gt;  &lt;p&gt;With this all my javascript code and PostBack events work like a charm!&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:51215523-e44e-4613-99c8-324fa1545d51"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/MOSS" rel="tag"&gt;MOSS&lt;/a&gt;,&lt;a href="http://technorati.com/tags/javascript" rel="tag"&gt;javascript&lt;/a&gt;,&lt;a href="http://technorati.com/tags/showModalDialog" rel="tag"&gt;showModalDialog&lt;/a&gt;,&lt;a href="http://technorati.com/tags/PostBack" rel="tag"&gt;PostBack&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blog.avanadeadvisor.com/aggbug.aspx?PostID=11369" width="1" height="1"&gt;</description></item><item><title>MenuItemTemplate and ClientOnClickUsingPostBackEvent</title><link>http://blog.avanadeadvisor.com/blogs/johanr/archive/2008/06/11/11348.aspx</link><pubDate>Wed, 11 Jun 2008 11:01:20 GMT</pubDate><guid isPermaLink="false">5e51d585-b788-4f7c-85ba-1877739ce145:11348</guid><dc:creator>johanr</dc:creator><slash:comments>1</slash:comments><comments>http://blog.avanadeadvisor.com/blogs/johanr/comments/11348.aspx</comments><wfw:commentRss>http://blog.avanadeadvisor.com/blogs/johanr/commentrss.aspx?PostID=11348</wfw:commentRss><description>&lt;p&gt;I spend a fair amount of time before figuring out how to implement a Menu Item that would trigger a Post Back Event.&amp;#160; So, thanks to &lt;a href="http://blogs.msdn.com/powlo/archive/2007/02/25/displaying-custom-data-through-sharepoint-lists-using-spgridview-and-spmenufield.aspx" target="_blank"&gt;Powlo's blog&lt;/a&gt;, &lt;a href="http://www.thesug.org/blogs/patrickr/Lists/Posts/Post.aspx?List=8afc69af%2Df9fc%2D4786%2D816f%2D6419264c42da&amp;amp;ID=2" target="_blank"&gt;SharePoint Users Group&lt;/a&gt; and the &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3122845&amp;amp;SiteID=1&amp;amp;pageid=0" target="_blank"&gt;MSDN forum&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;My overall goal was to implement a &amp;quot;Delete&amp;quot; MenuItemTemplate that triggers a Event on the server.&amp;#160; Here are the steps for my implementation:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Implement the IPostBackEventHandler and its RaisePostBackEvent method.&lt;/li&gt;    &lt;li&gt;Add the MenuItemTemplate as follow in the aspx file:&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;lt;SharePoint:MenuItemTemplate ID=&amp;quot;DeletePortfolioMenuItem&amp;quot;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; runat=&amp;quot;server&amp;quot;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Text=&amp;quot;Delete&amp;quot;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Description=&amp;quot;Delete this Portfolio&amp;quot;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ImageUrl=&amp;quot;/_layouts/images/delitem.gif&amp;quot;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Sequence=&amp;quot;2&amp;quot;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ClientOnClickPostBackConfirmation=&amp;quot;Are you sure you want to delete this item?&amp;quot;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ClientOnClickUsingPostBackEvent=&amp;quot;__page,%Name%&amp;quot; /&amp;gt;&lt;/p&gt;  &lt;p&gt;Or in the codebehind by setting the ClientOnClickPostBackConfirmation and ClientOnClickUsingPostBackEvent in the CreateChildControls method:&lt;/p&gt;  &lt;p&gt;protected override void CreateChildControls()   &lt;br /&gt;{    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; base.CreateChildControls(); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; DeletePortfolioMenuItem.ClientOnClickPostBackConfirmation = &amp;quot;Are you sure you want to delete this item?&amp;quot;;   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; DeletePortfolioMenuItem.ClientOnClickUsingPostBackEvent = &amp;quot;__page,%Name%&amp;quot;;    &lt;br /&gt;}&lt;/p&gt;  &lt;p&gt;The %Name% parameter is used here as the TokenNameAndValueFields in the SPMenuField of the SPGridView.&amp;#160; Its value is passed to the Event Argument of the RaisePostBackEvent method.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Note:&lt;/u&gt; The functionality can also be implemented with the ClientOnClickScript as follow:&lt;/p&gt;  &lt;p&gt;DeletePortfolioMenuItem.ClientOnClickScript = &amp;quot;if (confirm('Are you sure you want to delete this item?')) __doPostBack('&amp;quot; + this.UniqueID + &amp;quot;','%Name%')&amp;quot;;&lt;/p&gt;  &lt;p&gt;   &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:392986f3-ce81-48c5-af53-fb00ebd78ef6"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/MOSS" rel="tag"&gt;MOSS&lt;/a&gt;,&lt;a href="http://technorati.com/tags/SharePoint%202007" rel="tag"&gt;SharePoint 2007&lt;/a&gt;,&lt;a href="http://technorati.com/tags/MenuItemTemplate" rel="tag"&gt;MenuItemTemplate&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ClientOnClickUsingPostBackEvent" rel="tag"&gt;ClientOnClickUsingPostBackEvent&lt;/a&gt;&lt;/div&gt;&lt;/p&gt;&lt;img src="http://blog.avanadeadvisor.com/aggbug.aspx?PostID=11348" width="1" height="1"&gt;</description></item><item><title>New MIME to host Silverlight 2 Beta 1</title><link>http://blog.avanadeadvisor.com/blogs/johanr/archive/2008/04/08/10838.aspx</link><pubDate>Tue, 08 Apr 2008 13:42:03 GMT</pubDate><guid isPermaLink="false">5e51d585-b788-4f7c-85ba-1877739ce145:10838</guid><dc:creator>johanr</dc:creator><slash:comments>0</slash:comments><comments>http://blog.avanadeadvisor.com/blogs/johanr/comments/10838.aspx</comments><wfw:commentRss>http://blog.avanadeadvisor.com/blogs/johanr/commentrss.aspx?PostID=10838</wfw:commentRss><description>&lt;p&gt;Recently, I upgraded my personal blog that contains a little Silverlight animation from Silverlight Alpha 1.1 to Silverlight 2 Beta 1.&amp;#160; So, I basically recreated my Silverlight project to have a look at the new features.&lt;/p&gt;  &lt;p&gt;When came the moment to deploy this new version to my host,&lt;em&gt;&amp;#160;&lt;/em&gt;I had a surprise: the animation was totally blank! :(&lt;/p&gt;  &lt;p&gt;So, what?&lt;/p&gt;  &lt;p&gt;Silverlight 2 now packs all required resources into a &lt;strong&gt;.XAP &lt;/strong&gt;file (this is already the case for .XPS files).&amp;#160; So, this new type has to be added to IIS as &lt;strong&gt;application/x-silverlight-app&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Links:&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://silverlight.net/forums/t/11187.aspx" target="_blank"&gt;How to configure IIS 6.0 to host Silverlight 2&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/brada/archive/2008/03/14/using-silverlight-2-on-a-production-web-server.aspx" target="_blank"&gt;Using Silverlight 2 on a production Web Server&lt;/a&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:b1264693-515a-4766-9759-139eeeddeacf"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Silverlight" rel="tag"&gt;Silverlight&lt;/a&gt;,&lt;a href="http://technorati.com/tags/2%20Beta%201" rel="tag"&gt;2 Beta 1&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Host" rel="tag"&gt;Host&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Deploy" rel="tag"&gt;Deploy&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blog.avanadeadvisor.com/aggbug.aspx?PostID=10838" width="1" height="1"&gt;</description></item><item><title>SharePoint 2007 Workflow with InfoPath</title><link>http://blog.avanadeadvisor.com/blogs/johanr/archive/2008/03/21/10511.aspx</link><pubDate>Fri, 21 Mar 2008 14:39:25 GMT</pubDate><guid isPermaLink="false">5e51d585-b788-4f7c-85ba-1877739ce145:10511</guid><dc:creator>johanr</dc:creator><slash:comments>1</slash:comments><comments>http://blog.avanadeadvisor.com/blogs/johanr/comments/10511.aspx</comments><wfw:commentRss>http://blog.avanadeadvisor.com/blogs/johanr/commentrss.aspx?PostID=10511</wfw:commentRss><description>&lt;p&gt;This subject has already been described and detailed for a long time, so, the intent of this post is not to add another implementation on the subject, but gives a checklist and shares few issues faced.&lt;/p&gt;  &lt;p&gt;This checklist has been done using the following tools:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;MOSS 2007 &lt;/li&gt;    &lt;li&gt;Visual Studio 2005 &lt;/li&gt;    &lt;li&gt;InfoPath 2007 &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Setup the Working Environment&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;1. Open Visual Studio 2005 and create a SharePoint Server Sequential Workflow project.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;InfoPath Form&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;2. Open InfoPath 2007 and create a new Design Form Template.&lt;/p&gt;    &lt;p&gt;3. Add controls and fields to the InfoPath form.&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;4. Check the Compatibility of the form.&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;5. Change the Security to &amp;quot;Domain&amp;quot;.&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;6. Save the InfoPath file and Publish the form to &amp;quot;DevelopmentFiles/FeatureFiles&amp;quot; folder in the Visual Studio 2005 project that was created in step# 1.&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;7. Save the InfoPath form as Source File.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;Visual Studio Project&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;8. Execute the xsd.exe tool on the newly created myschema.xsd source file: &lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;Example: xsd.exe myschema.xsd /c&lt;/em&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;This will generate the class corresponding to the fields used in the InfoPath form.&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;9. Copy and rename the myschema.cs to the Visual Studio project.&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;10. Update feature.xml and workflow.xml using Snippets.&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;11. Code your workflow activities.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;Deployment&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;12. Open the Project Properties, click on Build Events and change &amp;quot;NODEPLOY&amp;quot; to &amp;quot;DEPLOY&amp;quot; in Post-build event command line&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;13. Sign the assembly and install it to the GAC.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;From this point you should be able to access your Workflow from &amp;quot;Site Settings / Galleries / Workflows&amp;quot;, and attach it to any List.&lt;/p&gt;  &lt;p&gt;If you need to access the Workflow from the SharePoint Designer few more steps are needed.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Setup the Workflow for SharePoint Designer&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;14. Add an action entry in the WSS.ACTIONS file located in the following path:&lt;/p&gt;    &lt;p&gt;&lt;em&gt;C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\Workflow&lt;/em&gt;&amp;#160;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;15. Add an authorizedType entry to the web.config file of the Web Application.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now, the Workflow action is accessible from the New Workflow menu option.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Issues Faced&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The main issue faced is whenever you have an error in your InfoPath form and you get &amp;quot;The form has been closed&amp;quot; in SharePoint, or whenever you want to update the InfoPath form, the easiest is to delete the InfoPath Template and re-create a new one. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;u&gt;Links:&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblog.vb-tech.com/nick/archive/2007/02/25/2207.aspx" target="_blank"&gt;SharePoint 2007 Workflow with Visual Studio 2005 + InfoPath 2007&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblog.vb-tech.com/nick/archive/2006/09/04/1760.aspx" target="_blank"&gt;Deploying a custom MOSS 2007 workflow&lt;/a&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:aec93ba1-a8ab-4299-9f04-0c945463c799"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/MOSS%202007" rel="tag"&gt;MOSS 2007&lt;/a&gt;,&lt;a href="http://technorati.com/tags/SharePoint%202007" rel="tag"&gt;SharePoint 2007&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Workflow" rel="tag"&gt;Workflow&lt;/a&gt;,&lt;a href="http://technorati.com/tags/InfoPath" rel="tag"&gt;InfoPath&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blog.avanadeadvisor.com/aggbug.aspx?PostID=10511" width="1" height="1"&gt;</description></item><item><title>Windows Vista SP1 and Windows Server 2008 set for Launch!</title><link>http://blog.avanadeadvisor.com/blogs/johanr/archive/2008/02/04/8455.aspx</link><pubDate>Mon, 04 Feb 2008 10:22:00 GMT</pubDate><guid isPermaLink="false">5e51d585-b788-4f7c-85ba-1877739ce145:8455</guid><dc:creator>johanr</dc:creator><slash:comments>0</slash:comments><comments>http://blog.avanadeadvisor.com/blogs/johanr/comments/8455.aspx</comments><wfw:commentRss>http://blog.avanadeadvisor.com/blogs/johanr/commentrss.aspx?PostID=8455</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial&gt;Both versions will be available mid-March.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;After a little check on MSDN Subscriber, WS2008 x64 is already available for download!&amp;nbsp; The other versions are coming.&amp;nbsp; The good news is it already contains Hyper-V (other versions will be available Without Hyper-V).&amp;nbsp; After using the RC1 on my laptop for a couple of weeks, I can say that my short experience is really positive: it's a lot faster on my configuration with Hyper-V than my previous one with Vista x86 and Virtual PC, and that it has been really stable until now.&amp;nbsp; So, I am pretty eager to install the final version.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;For more details about the install,&amp;nbsp;follow &lt;A href="/blogs/bryantl/archive/2008/01/07/7697.aspx"&gt;Bryant&lt;/A&gt;'s post about switching his laptop to Windows Server 2008.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=1&gt;&lt;U&gt;Links:&lt;/U&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.informationweek.com/management/showArticle.jhtml?articleID=206103605"&gt;&lt;FONT face=Arial size=1&gt;Windows Vista SP1 Set For Launch, Microsoft Says&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.zdnet.fr/actualites/informatique/0,39040745,39378129-1,00.htm"&gt;&lt;FONT face=Arial size=1&gt;Windows Vista SP1 et Windows Server 2008 finalisés&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blog.avanadeadvisor.com/aggbug.aspx?PostID=8455" width="1" height="1"&gt;</description></item></channel></rss>