Posted By: Daniel Moth | Feb 23rd, 2008 @ 2:09 PM | 9,967 Views | 12 Comments

Author: Hi, I am Daniel Moth Smiley

Introduction: In this 18' video you will learn from scratch how to take advantage of .NET Client Application Services. As usual, the code and links to the documentation are available from my blog.

Video download: For this video, click on the image/button to play the video OR right click and Save As on the same location.

Media Downloads:
Rating:
0
1
Hello, full screen video is "mirrored" - start menu on top etc.
Hi Daniel,

Thanks for the great video presentation of client application services. I want to use it with Windows authentication and a custom roleprovider in a sql database. Can you change the authentication method to Windows in your sample application and can you then still access your roles if you add a user with the same name as your Windows login name (domain\username)? It does not work for me and it would prohibit me from using it which would be a shame.

Thanks,
Martin.
Martin what you are trying should work.
Can you share more details on what problems you are encountering?
I would like to know how to use the Application Services for Multiple applications. If i have Application A and Application B and both  have to use the same SQl Provider.

Do i have to have two WebServices to accomplish this or can i just use a single web service to accomplish this.

If you have any examples I owuld greatly appreciate it.
staceyw
staceyw
Before C# there was darkness...
How can you prevent the client token from expiring?  I am using client app services now in test, but it keeps asking for login during Membership.ValidateUser() after some X period of time.  After my client logs in, I don't want anymore prompting until they logout or switch user. tia
JBailey
JBailey
In an infinite universe, all things are possible
I've been struggling with CAS for a while and was happy to see your demo.  Unfortunately your demo gives me poorer results than my own efforts. 

I am running Vista Ultimate SP1 and Visual Studio 2008 Professional SP1.  I have .Net 3.5 sp1 installed.  SQL Server 2005 Express is at SP3.  I loaded the demo and tried to authenticate with boss666!/boss666! and got a failed authentication.  I added a user of my own using the ASP.Net manager tool just in case it was an issue with the id and password and tried it and again got a failed authentication.  I have tried it on both my laptop and desktop development machines with the same result.

With my custom providers the authentication works, but no roles or settings are available.  When trying to access the settings it gives an error stating that you have to be authenticated to call the function.  Checking the IsAuthenticated property of the identity before hand gives a true response, but I still get the error.

I'm not really sure what could be the issue here.  When debugging my custom providers, I see the authentication service called, but the role service it is never called.  I can't really debug your demo as there isn't any real code in the server side.

I appear to be one of many who are having issues.  Does anyone have a clue what could be the issue or is CAS just too buggy to use in any kind of a real environment?

JBailey
JBailey
In an infinite universe, all things are possible
If I set the connectivity status explicitly to online ( I had originally just commented out the code where it was set to offline), the demo authenticates, but then I get the same results as in my custom providers.  I changed the load button method to the following:

private void btnLoad_Click(object sender, EventArgs e)
{
    if (Thread.CurrentPrincipal.Identity.IsAuthenticated)
    {
        txtLow.Text = Settings.Default.lowValue.ToString();
        txtHigh.Text = Settings.Default.highValue.ToString();
    }
}


and I get the following error when I select the Load button:

Error status code returned by the Web Service: InternalServerError. Error details from service: {"Message":"You must log on to call this method.","StackTrace":"   at System.Web.ApplicationServices.ApplicationServiceHelper.EnsureAuthenticated(HttpContext context)\r\n   at System.Web.Profile.ProfileService.GetPropertiesForCurrentUser(IEnumerable`1 properties, Boolean authenticatedUserOnly)","ExceptionType":"System.Web.HttpException"}

Again, I'm not sure what would cause the roles and profile to fail, but it looks like these services do not think the user is logged in even though the IsAuthenticated property on the principal is true.

Any help or suggestions would be appreciated.
JBailey
JBailey
In an infinite universe, all things are possible
It looks like the issue I was having was related to the automatic cookie detection at the server.  I added the following to the web.config for the web service:
  <authentication mode="Forms">
       <forms cookieless="UseCookies" />
  </authentication>

The default is to autodetect.  Client Application Services does not work without cookies and for some reason the autodetect must be determining that cookies are not supported.  It works when I force cookie support at the server.

Microsoft Communities