First time here?

You are looking at the most recent posts. You may also want to check out older archives. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS or email. Thank you for visiting!

We’ve update the .NET RIA Services build for May 2009.  The updated May preview can be downloaded here: .NET RIA Services May 2009.  You may have to uninstall your previous version before installing this one. 

What is .NET RIA Services?
Microsoft .NET RIA Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms. The RIA Services provides a pattern to write application logic that runs on the mid-tier and controls access to data for queries, changes and custom operations. It also provides end-to-end support for common tasks such as data validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier.

This update incorporates a bunch of fixes that have been reported in the RIA Services forum.  This is a good place to report issues and communicate with the dev team.  Most fixes came from the forum.  In addition, DomainService base classes now infer some data access metadata based on the model (length, required for example).  There are a few other samples that were added to this as well to note:

Also upon installing you’ll see a new project type called the Business Application Template.  Right now it looks and feels exactly like the navigation template with the Silverlight tools, but has a few defaults added, namely authentication.  You’ll see in the ASP.NET project there with a Services folder and three new files: AuthenticationService, UserInformation, UserRegistrationService.  These are all services to expose authentication and membership integration.  Running the template by default will give you a new “login” link in the upper right and clicking on that implements a new ChildWindow for login:

Biz App Login Template

Notice the "Register now” link which then uses another ChildWindow control for registration:

Biz App Register Template

Registering a new user uses the UserRegistrationService to add a new user to the system.  If you look at the UserRegistrationService you’ll see that it uses the ASP.NET Membership APIs:

   1: namespace BusinessApplication2.Web
   2: {
   3:     [EnableClientAccess]
   4:     public class UserRegistrationService : DomainService
   5:     {
   6:         // NOTE: This is a sample code to get your application started. In the production code you would 
   7:         // want to provide a mitigation against a denial of service attack by providing CAPTCHA 
   8:         // control functionality or verifying user's email address.
  10:         public void AddUser(UserInformation user)
  11:         {
  12:             MembershipCreateStatus createStatus;
  14:             // NOTE: ASP.NET by default uses SQL Server Express to create the user database. 
  15:             // CreateUser will fail if you do not have SQL Server Express installed.
  17:             Membership.CreateUser(user.UserName, user.Password, user.Email, user.Question, user.Answer, true, null, out createStatus);
  18:             if (createStatus != MembershipCreateStatus.Success)
  19:             {
  20:                 throw new DomainServiceException(ErrorCodeToString(createStatus));
  21:             }
  22:         }
  24:         // other methods exist here
  25:         // ...
  26:     }
  27: }

Because the membership APIs are provider-based, you can leverage whatever you want for your membership model and still use those APIs.  The example uses the default mechanism in ASP.NET.

Download the updated RIA Services bits today and take a look at the new template for integrating with the various ASP.NET providers.  Thanks for the continued feedback and keep it coming!

This work is licensed under a Creative Commons Attribution By license.

5/19/2009 10:49 AM | # re: .NET RIA Services Update with new Silverlight project template
Is it possible to write an article showing how to use membership APIs for this template?
Basically adding the missing pieces to make it work.
Thanks so much.
5/19/2009 11:26 AM | # re: .NET RIA Services Update with new Silverlight project template
Hi tim.

.NET RIA Service is my favorite feature in Silverlight news. This month i write a article for .NET Magazine ( A braziliam magazine ) about .NET RIA Service. Is very simple to development using that and incredibly easy. This new template is great to understand how the .NET RIA Service use the ASP.NET authentication services. Very very good. With the last new features, the Silverlight platform increase the productivity, learn curve, and UX capabilities whit the SketchFlow.
5/20/2009 1:48 PM | # re: .NET RIA Services Update with new Silverlight project template
Hi Tim,
Does this work with VS2010? when I tried to install it said required components are missing
5/20/2009 2:14 PM | # re: .NET RIA Services Update with new Silverlight project template
No, RIA services bits will likely not work with VS2010 at this point...couldn't get things in time for Beta 1
5/28/2009 2:45 PM | # re: .NET RIA Services Update with new Silverlight project template
Will there be any "Training-Video" like your Video for the great Navigation-Framework or OOB for the .NET RIA Services?
5/28/2009 3:44 PM | # re: .NET RIA Services Update with new Silverlight project template
Alexander -- we will for the SL3 release, yes.
5/29/2009 12:23 AM | # re: .NET RIA Services Update with new Silverlight project template
Great Thanks ;D
11/3/2009 3:37 PM | # re: .NET RIA Services Update with new Silverlight project template
I tried using the Silverlight business application template in VS 2008 to create RIA a webservice.
I did see the generated code in the web application project where I need to use this RIA service, but I don't see the call back method in the DomainContext class. Hence I have to call my method sync way. I have used the right attributes in my DomainService class.

Can you please let me know if I'm missing anything.

3/18/2010 2:10 PM | # re: .NET RIA Services Update with new Silverlight project template
Hello guys,

I am trying to extend the registration form by adding another field called 'Auth Token' and validating the data by adding function to the UserRegistrationService.cs file and if the validation fails then I am trying to throw an error to DomainException(ErrorCodeToString('Invalid auth token')) but there is no Invalid Auth Token enum defined in the MembershipCreateStatus so I have just passed the string to the DomainException('Invalid auth token') but this does not display the error message to the user as it does with the other fields such as 'Invalid User Name' or'Invalid Password'.

I have tried to override the membershipstatus enum but no success, have you guys come across similar issue?

3/19/2010 2:19 AM | # re: .NET RIA Services Update with new Silverlight project template

yes i encountered the same problem, this example was ok for July 2009 release, but not anymore, DomainServiceException doesn't exist anymore... or at least has changed name... maybe DomainServiceErrorInfo ? nope...
3/22/2010 2:11 PM | # re: .NET RIA Services Update with new Silverlight project template

I have used DomainException("Invalid Auth Token") but this does not display the same style of error message as it does with other built-in fields, for example if you enter an invalid user name or password match then you would get a short message with red background and the message box is attached to the field it belongs. But with DomainException, it is more like a pop-up window with the error messsage 'Invalid Auth Token' and the error details in the drop down.

4/12/2010 1:27 PM | # Tim: You are doing a great job
you are doing a good job. Keep it up.

Please add 5 and 4 and type the answer here:


The opinions/content expressed on this blog are provided "ASIS" with no warranties and are my own personal opinions/content (unless otherwise noted) and do not represent my employer's view in any way.