Shan McArthur

As Vice President - Technology and Senior Architect of ADXSTUDIO CMS, Shan exhibits a profound dedication and proficiency in his field. Having specialized in the IT industry for over a decade, his experience and knowledge support his instrumental role in the architecture and ongoing development of the company's web development technology.
Tags
CRMUG User Group Website
Customer Portal Modifications for Demo VPC without Internet Connectivity
June 7, 2010 11:03 PM |
Comments (5) 
| Rate this article: 

Background

Microsoft launched a new generation of xRM portals in May 2010 (complements of Adxstudio). These new portals are significantly different than the previous generation. A decision was made early in the development lifecycle to ship the sample portal sites that are given on CodePlex using best practices. This requirement was driven from a desire to have a sample website that could pass standard security reviews. Part of these requirements use web-based services such as Live ID for authentication and an online Captcha service from Microsoft Research labs for user validation. The user signup process uses an invitation model plus a challenge/response mechanism to create new portal users. These requirements are complex and really do not demo very well because of the additional complexities that they introduce. Many people using the Microsoft demo VPC are hosting the VPC in a network environment that does not have internet access. This whitepaper will describe a manner of reconfiguring the customer portal website so that it is easy to demo on the standard demo VPC without having any dependencies on internet connectivity.

Removing Captcha Implementation

The Captcha implementation on the Contact Us form requires internet accessibility. If you would like to remove the captcha from the form, follow these steps:

  1. Open the website project in Visual Studio 2008.
  2. Open the /PagesContactUs.aspx page.
  3. Remove the <fieldset> element in the <InsertItemTemplate> section of the <CrmEntityFormView> control.
Removing Captcha from ASP.NET page

 

 

Your file should look like this when you are done:

 

 

4. Open the code-behind for the page (ContactUs.aspx.cs). Remove the AddAssiraValidation method and the call to it in the Page_Load method

 

 

 

 

Your file should look like this when done:

 

 

Using Active Directory Membership Provider

The default implementation uses Live ID for portal user authentication. The implementation also uses a secure invitation mechanism that also uses a challenge/response mechanism to activate a portal account. This mechanism requires a complex series of steps to enable new portal users and it also requires an active internet connection. Finally, it requires that you set up the portal under a particular domain name and provision a Live ID application. For demonstration purposes, it is more desirable to use a simpler authentication mechanism that can be configured easily. Since the demo VPC is a domain controller, and accounts are already configured, switching the portal to use Active Directory for authentication is fairly desirable.

Follow these steps to change the portal to use Active Directory for user authentication:

1. Open the web project with Visual Studio 2008.
2. Locate the web.config file and insert the following <forms> element into the <authentication> element:

<forms loginUrl="/login" timeout="525600"/> 

 

 

3. Add a connection string in the <connectionStrings> section to point to an appropriate OU in Active Directory.

<add name="ADConnectionString" connectionString="LDAP://contoso.com/CN=Users,DC=contoso,DC=com" />

 

 

Locate and replace the existing membership provider with the following:

<add name="CrmMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider" connectionStringName="ADConnectionString" attributeMapUsername="sAMAccountName"/>

 

 

4. Locate the master page in MasterPages/Default.master and remove the LiveIdLoginStatus control.

 

 

5. Add the LoginStatusControl to the LoggedInTemplate:

<asp:LoginStatus runat="server" />

6. Add an AnonymousTemplate with a CrmHyperLink control:

<AnonymousTemplate>
  <crm:CrmHyperLink runat="server" SiteMarkerName="Login" />
</AnonymousTemplate>

Your final page should look like this:

 

 

7. Edit the code-behind for that page (default.master.cs) and delete the code that references the LiveLoginStatus control from the Page_Load method:

 

 

8. Locate the /Pages/Login.aspx page. Cut out the LiveIdLoginStatus control.

 

 

and replace it with a standard ASP.NET login control

 

 

9. Locate the code-behind for that page (Login.aspx.cs) and remove the entire else section in the Page_Load method:

Your file should now look like this:

 

 

10. Open a browser and navigate to your CRM. Create a new contact for the webmaster:

 

 

Switch to the Web Authentication tab and enter the domain username and turn on the Logon Enabled checkbox:

 

 

Save the contact record, then switch to the Web Roles section, then click Add Existing Web Role. Locate and add the Customer Portal Administrators webrole:

 

 

The web roles for the contact should look like this now:

 

 

11. Test the portal.

Start on the home page, anonymously:

 

 

Click on the logon link in the header and enter your network credentials:

 

 

When you successfully log in (watch it, it is case sensitive), you will see the CMS editing controls and the webmaster name in the header:

 

 

Technical Details

The portal framework can work with any ASP.NET membership provider.  The portal ships with a membership provider for Live ID, and this example shows how to swap it out for an Active Directory membership provider.  You can also use the old SQL Membership provider that was used in the old eService accelerator, or even upgrade to the commercial version of the portals from Adxstudio and use their contact/lead/user based membership providers which allow you to use CRM records for authenticating portal users.

Links & Attachments 
Comments (5)
#re:
Excellent post. Works perfectly.
6/11/2010 10:55:08 AM by ePartners
#re: Login errors
Hi Shan, I've followed these instructions to the letter but am installing to a clean virtual build-out on W2K8R2, SQL2008, GP2010, and CRM4 (OnPrem Enterprise). Everything seems to go fine, but when I try to login using the Administrator account, I get a .NET error that reads "Configuration Error" and refers to line 52 "type=System.Web.Security.ActiveDirectoryMembershipProvider". The parser error proclaims "A referral was returned from the server." What do you suppose could have gone wrong???
6/23/2010 12:37:32 AM by Alan
#re: RE: Login errors
Please disregard! I was missing the domain DC element for the LDAP connection string....
6/23/2010 3:54:47 PM by Alan
#re: Error while running web site after making changes
Hi, I followed steps mentioned above.When I compile project and try to run website I get following error: Server Error in '/' Application. -------------------------------------------------------------------------------- The LiveIdLoginStatus control requires an Adxstudio.Web.Security.LiveIdMembershipProvider Thanks.
6/30/2010 5:19:51 AM by Aswad
#re: Very helpful
Really useful article for setting up the Partner Portal in a demo environment - particularly with the well laid out screen shots at each step. Aswad - the error your experiencing may be due to commenting out the HTML for the LiveIdLoginStatus control, you do need to completely delete the HTML otherwise you do hit this error.
8/5/2010 5:39:16 PM by Paul McQuillan
Submit a Comment
Title:  
Name:    
Comment:    
Verification:

Type the characters you see in the picture below.