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
See the attached solution for all the code!
Looking for more?
Client application Services Screen webcast
Information about SQL Server Compact – Offline rocks!
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).