Brendan Enrick's Blog

Daily Software Development.


Quick Silverlight Tip: Looking at the code

Silverlight is a great technology, and one thing that really makes it a treat to work with is the ease with which one can access the code inside the XAP file. Yes, this means that someone can look at your code,  SO DON’T PUT ANYTHING SECURE IN THERE! I took Jeff Blankenburg’s Click the Button contest.

So for a while I though Jeff had tricked me on that puzzle until I opened up the XAP file and looked at the source code. On the last page of the Silverlight you see this screen.

Level 12

So what’s the big deal? Well, the level before it was titled “Level 10”, so I figured Jeff was trying to pull a fast one and there was more to this seemingly innocent page. So I tried to find how to get beyond this level 12 to the real one. I eventually took the smart route, and I opened .NET Reflector and pointed it at the DLL file for the contest.

How did I do that you ask? Here are some quick steps for looking at the source code of a Silverlight application.

Step 1: Download the .xap file. View the source of the HTML page or look at the NET tab in FireBug to get the .xap file and download it.

Step 2: Rename the file to .zip and open it. Yes, a .xap is really a .zip neat huh?

Step 3: Unzip the file and find the dll you’re looking for. In my case it is called “ClickTheButton.dll”

Step 4: Open up .NET Reflector and open up that dll file.

NewDllInReflector

Step 5: After examining the dll you’ll be able to see all of the code. In this case I can see that Jeff actually has 13 levels he created for this application.

You now have a choice to make. You can ask Jeff Blankenburg what happened to the other puzzles or just go and take a look at the code and see which levels are missing.

kick it on DotNetKicks.com

Trackbacks & Pingbacks

No trackbacks yet.

Trackback link for this post:
http://brendan.enrick.com/trackback.ashx?id=213

Comments

 avatar

Ian Smith said on 03 Feb 2010 at 8:54 AM

Or, alternatively, you coudl make life even easier for yourself by browsing to the URL with "Silverlight Spy" (http://silverlightspy.com/silverlightspy/download-silverlight-spy/) Silverlight Spy will let you just look at the source (by using Reflector if you tell it where your copy is installed) with a few mouse-clicks and tab selections :-)

benrick avatar

Brendan Enrick said on 03 Feb 2010 at 9:36 AM

Yes, you can, but Silverlight Spy is not technically free. Although, I guess you could just use the evaluation copy indefinitely.

Leave a Comment

Please join the discussion and share your thoughts.