Category: Silverlight

RIA Services: Access to operation ” was denied

While working on RIA Services and Silverlight you might get an error like this:

ria services silverlight access to operation error was denied
RIA Services access to operation was denied

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; HPNTDF; InfoPath.3; .NET4.0C; .NET4.0E; MS-RTC LM 8)
Timestamp: Fri, 18 Feb 2011 18:20:46 UTC

Message: Unhandled Error in Silverlight Application Load operation failed for query ‘GetUserDetails’. Access to operation ‘GetUserDetails’ was denied. at System.ServiceModel.DomainServices.Server.DomainService.ValidateMethodPermissions(DomainOperationEntry domainOperationEntry, Object entity)
at System.ServiceModel.DomainServices.Server.DomainService.ValidateMethodCall(DomainOperationEntry domainOperationEntry, Object[] parameters, ICollection`1 validationResults)
at System.ServiceModel.DomainServices.Server.DomainService.Query(QueryDescription queryDescription, IEnumerable`1& validationErrors, Int32& totalCount)
at System.ServiceModel.DomainServices.Hosting.QueryProcessor.Process[TEntity](DomainService domainService, DomainOperationEntry queryOperation, Object[] parameters, ServiceQuery serviceQuery, IEnumerable`1& validationErrors, Int32& totalCount)
at System.ServiceModel.DomainServices.Hosting.QueryOperationBehavior`1.QueryOperationInvoker.InvokeCore(Object instance, Object[] inputs, Object[]& outputs)
Line: 1
Char: 1
Code: 0
URI: http://yourapplicationwebsite/

The reason behind this is that the service you are calling requires privileges in order for it to be executed. This is specifically true when RequiresAuthenticationAttribute attribute or the RequiresRoleAttribute is applied to your service. To solve this error make sure that the application calling the service has the required access/permission to call the service method or you can remove both attributes on the service if the are not really needed(which might be risky).

How To: Create a BulletList in Silverlight

I was working on a prototype application today when I needed to use a BulletList. At first I thought it existed on the toolkit controls but to my surprise it wasn’t so I ended up creating an ItemsControl template that mimics how a BulletList would behave. I wanted to post it here to show you how I did it:

 

As allways you can download a sample project here: KeithRull.SLBulletList

Fun! Now time to get back to my code zen.

Cheers!

Expression Studio 4 is out and my 60-day tool

I was really excited last Monday after seeing Expression Studio 4 has been released (I have to admit that I’m one of those developers who logged in at MSDN at 12 midnight to check if the RTM bits are already out. hehe). I think this is great news for all XAMLers all over the world. On thing that I’m really sad about though is that our corporate MSDN license only has Expression Studio 4 Professional and not the Ultimate version. Bummed. So I ended up downloading the 60 day trial up until I can figure out how I can get a copy of the full version (OK, here’s the part that I ask donations to get a full copy but I’ll leave that out. LOL).

Sad, but still happy. At least I have 60 days to enjoy this new tool. 😉

Just Released: Silverlight 4 Tools for VS 2010, new SL themes and WCF RIA Services

Just in case you missed it, Tim Heuer has announced that Silverlight 4 Tools for Visual Studio 2010, WCF RIA Services and 3 new SL themes have been released today. This is an exciting news for Silverlight aficionados who have been waiting for the RTM version of SL4 Tools since the last RC who are itching to put their hands on this new set of goodies.

If you want to learn more about SL, the best place to start is to go to Silverlight.net and checkout the Getting Started section. I would also suggest you follow Tim’s blog and subscribe to his updates and also as follow Silverlight Cream for the latest stream of info from SL developers.

If you are looking for Silverlight books for beginners my suggestion would be to get Laurent’s book (a SL4 edition will come out in September) and start from there. You should also checkout Jeff Pairies mind boggling book about Silverlight animation and also John Papa’s classic SL book that talks about data-driven services with Silverlight. Although some of these books are 1-2 versions behind I still believe that there are a lot of value in them that you can still apply with your Silverlight 4 projects.

I’ve just downloaded the package via the WPI
and I can’t tell you how much excited I am to see SL4T-4-VS2010 RTMed.
This will surely be a fun week.

Nice, time to rock this ship!

How To: Creating Tooltips in Silverlight 2

Tooltips are great additions to any interface and in this article I’m going to show you how to attach a tooltip to control in Silverlight 2.


To start, let’s assume that we have a button that we want to add a tooltip to:


[XAML]


[Rendered UI]



In order or us to attach a tooltip to our button we need to create a reference to the TooltipService.Tooltip inside the our button’s XAML declaration. We also need to setup the Tooltip.Content to tell the compiler what to show when the user hover’s to our button.


[XAML]


[Rendered UI (at runtime)]



The message “Hooray! I’m alive!” appeared when the user hovers over our button. We can also cutomize how our tooltip appears by adding more XAML elements in the Tooltip.Content property.


[XAML]


[Rendered UI (at runtime)]



Another customization that you might want to do is specifying the HorizontalOffset and the VerticalOffset. This allows you to specify where the tooltip will appear in reference to your target control.

My MIX09 10K Contest Entry: Silverlight Pregnancy Calendar

I had some free time during the holidays and saw at the MIX09 website that they have a contest entitled MIX09 10K Challenge where they ask participant to create a web application that is either using Microsoft® Silverlight™ or Windows Presentation Foundation, as a XAML Browser Application running in Partial Trust or as a ClickOnce application in 10 kilobytes or less. I decided to take a stab at it and this is what I’ve came up with

SilverCalendar: A Silverlight Pregancy Calendar

You can see the app live here http://2009.visitmix.com/MIXtify/TenKDisplay.aspx?SubmissionID=0051

Dont forget to vote when you’re there 😛 LOL

My primary motivation when I built the app is the idea of having something that is going to be useful and at the same time fun to build. My wife is currently 34 weeks pregnant and it made me think that a pregnancy calendar would be q great application to do since it relates to me and my current day to day life. I love pregnancy calendars because it gives you a good daily insight on the progress of your baby and what you might expected as you go along in your daily life as a soon to be parent.

The application that i built is using Microsoft Silverlight 2 with a backend WCF web service. You can find the pregnancy calendar web service here. I wasn’t able to add any animations to the application because I decided to concentrate in adding functionality to app rather than the eye candy’ With that said, I’ll be posting the non-10K application this week.

Be sure to comeback on this blog in the coming weeks because I’ll be publishing the source code to both project soon together with a 11 part tutorial and screencast walkthrough that i have prepared to show how to to build an application using .NET 3.5, WCF, WPF and Silverlight.