Partager via


.NET Client Application Services

Update:  hree are some MSDN docs that cover this topic: Exposing Web Services to Client Script and ASP.NET Application Services Overview  

One of my favorite features in Orcas is the ability to leverage the ASP.NET Application services from any client application (ASP.NET, Ajax, WinForms, WPF, or even Silverlight!)..  This allows you to do things like share a common membership, role management and profiles across a number of presentation tiers.  It also enables very easy roaming user state...

Check out how easy it is to use the profile store... here I am using Windows Authentication, but of course you can use forms or your own system just as well.  In fact any system can be rolled into the ASP.NET Auth system (there is a whole book on the subject).

 

Part 1: Create the web site.

1. In Orcas Beta1, Create a new ASP.NET Web Application

2. Fill in the profile section of the web.config.  Notice, you have to enable anonymous for the client designer functionality in Beta1 to work...

3. Enable this property to be accessed via web services by adding this section to Web Config

 

Part 2: Create the client app.

1. Right click on the solution and add a new project (works the same for WPF or WinForms)

2. Right click on the new client project and select properties

3. In the Services tab, enable application services, select windows auth and fill in the services url.  For now it is the development server, URL, in production this would be your ASP.NET web site.

 

4. In the settings tab, click on Load Web Settings... this will pull down all the metadata for the profile properties you defined on the server.     You can just hit "skip login" on the prompt for you credentials... Because we enabled anonymous auth, it is not needed

 

You are now ready to go!    You can have strongly typed, async read-write access from WPF, WinForms, Silverlight, ASP.NET and Ajax.  And all the user settings will stay in sync no mater where you change them, they are reflected everywhere!

 Check out a few examples

ASP.NET Server side code

Client side JavaScript

 

 

See the attached solution for all the code!

 

Looking for more?

 

Client Application Services in Windows Forms: End-to-End Walkthrough Available

What’s new in for clients apps in Orcas deck

Client application Services Screen webcast

Information about SQL Server Compact - Offline rocks! 

DEV10 - Extending the Browser Programming Model with Silverlight

Update... You can get the demo code for how to do this from Silverlight here.. The StockClient/StockService samples make use of the profile (to store the selected stock symbol) and isolated storage (to cache the stock data of the selected stock symbol).

AppServicesDemo.zip

Comments

  • Anonymous
    May 23, 2007
    PingBack from http://blogs.msdn.com/brada/archive/2007/05/23/net-client-application-services.aspx

  • Anonymous
    May 23, 2007
    "presentation tears."...tears...as in crying. I think you mean Tiers.

  • Anonymous
    May 23, 2007
    Thanks for this great nice post, but now I have tiers in my eyes, because the images are so blurry and very hard to read :)

  • Anonymous
    May 24, 2007
    The comment has been removed

  • Anonymous
    May 24, 2007
    Please tell me that the blurry screenshots are because you dialed in too much compression and not because you used the camera on your phone to take screenshots. -Don

  • Anonymous
    May 24, 2007
    Client Application Services in "Orcas"

  • Anonymous
    May 24, 2007
    Those blurry images... are you pasting into Windows Live Writer? If so don't  use drop shadow border option.

  • Anonymous
    May 29, 2007
    Damian, It doesn't matter. Live Writer eats the images up any way you slice it. I've mentioned this bug to them multiple times and have yet to see a fix. It's the main reason why I still use BlogJet (and pay for it..)

  • Anonymous
    May 30, 2007
    good

  • Anonymous
    May 31, 2007
    "You are not ready to go!"  I assume you meant "You are now ready to go"?  Or is this one of those "Paging Dr. Freud" moments? :) -B

  • Anonymous
    May 31, 2007
    Brian -- thanks!  fixed!

  • Anonymous
    June 02, 2007
    I spent my first few minutes experimenting with the new Client Application Services in "Orcas" today...

  • Anonymous
    June 03, 2007
    This Teched in Orlando the new client application framework called " Acropolis " will be announced. From

  • Anonymous
    June 03, 2007
    .NET Client Application Services Client Application Services in Windows Forms: End-to-End Walkthrough...

  • Anonymous
    June 06, 2007
    In my first post on parameterized queries I built a simple login form that really was a contrived example

  • Anonymous
    June 06, 2007
    In my first post on parameterized queries I built a simple login form that really was a contrived example

  • Anonymous
    June 06, 2007
    Re blurry images - in Live Writer use "Inherit From Web Log" option for borders configuration, try it and you will notice the difference immediately

  • Anonymous
    July 27, 2007
    Is there any way to link things in a bigger way than simply sharing the backend authentication / profiles providers functionality? I'm interested in using a WPF application to leverage it's great UI facilities, but maintaining an existing ASP.Net Web Application for most of what I need to do. Is there any way I can provide a click-through experience, where a user that is authenticated in my WPF application can seamlessly enter the web-app without needing to supply credentials again? Having only one membership, roles and profiles store is great, but linking things up on the UI is almost as important!

  • Fred
  • Anonymous
    August 08, 2007
    Our first .NET geek dinner was great!

  • Anonymous
    August 29, 2007
    One of the neat features that Windows Forms developers get with the .NET Framework 3.5 and Visual Studio

  • Anonymous
    September 07, 2007
    Today, let me talk about enhancements to ASP.NET that you will see with Visual Studio 2008 and .NET FX

  • Anonymous
    September 10, 2007
    [原文地址] ASP.NET enhancements in VS2008 and .NET FX3.5 [原文发表时间] Saturday, September 08, 2007 12:24 AM 今天

  • Anonymous
    May 05, 2008
    In ASP.NET 2.0, we introduced a very powerful set of application services in ASP.NET ( Membership , Roles