Tags: | Categories: Blog Posted by admin on 10/28/2009 3:02 PM | Comments (0)

When you get this error “ASP.NET runtime Failed to start monitoring changes (…) ” on your ASP.NET app is frustrating to find what is causing this problem, normally is when you moved an application from a computer to another. I personally seen it happen in Windows Vista and Windows 7 machines.

The solution.

If you using impersonation you’ll find that removing the impersonation key will fix your issue, of course you need impersonation for your application to have access to other resources. I recommend to add that user in the ASP.NET process account.


Documentation of the issue from Microsoft can be found here.


Hope this helps


Follow me in twitter | bookmark me | Subscribe to my feed | Add stats to your blog

Tags: | Categories: Blog Posted by admin on 10/20/2009 12:16 PM | Comments (4)

The installation to upgrade from Vista to Windows 7 does not fix or upgrades IIS 7. So IIS 7 wasn’t fix to run Silverlight xap files of Windows Services.

When trying to run a Windows Service with SVC extension on a Windows 7 machine that was upgraded from Vista, IIS 7 won’t be changed to register the .xap file for silverlight or windows services extensions, you’ll have to do that manually in IIS 7.

Registering the Silverlight XAP extension.

Go to your IIS Manager and open the Mime Types


For File extension enter: .xap

For Mime type enter: application/x-silverlight-app



Register the Windows Service on IIS7

Do not register the .svc extension like xap, you need to register in a different way, open a console application running as Administrator, navigate to:

C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>

Run ServiceModelReg –i


Finally restart IIS with a normal Iisreset or using the IIS manager.

Hope this helps



Follow me in twitter | bookmark me | Subscribe to my feed | Add stats to your blog

Tags: | Categories: Blog Posted by admin on 10/9/2009 12:02 PM | Comments (1)

I was lucky enough to travel to Bogota to teach a ESRI ArcGIS Silverlight API workshop for the LAUC. All ESRI distributors in South America came to the conference and some came to the workshop. Was great meeting all the people passionate about GIS. It’s always great to travel to different countries and learn new cultures. Kills me to be away from my wife and kids, yet the opportunity of seeing new countries and meeting new people is just great. Below a few snapshots of the week.

photo-2 Picture above the ESRI logo in Spanish

photo-3The class learning the ESRI Silverlight API for ArcGIS Server.


Picture above of the students attending the Silverlight workshop from different ESRI distributors at break time.


Picture above a lunch with all the students, Silverlight and Flex.

photo-1Picture above a menu item, the World Trade Center for $13,500 pesos. 


Kerry Coffin (the Flex instructor) with the Mayor of Bogota.


Was great meeting all the great people that is passionate in GIS, Bogota is a huge busy metropolitan city that I won’t mind to come back, as this time I wasn’t enable to visit the city. Next year the ESRI Latin America User Conference will be hosted at the city of Mexico by the ESRI Distributor.

Follow me in twitter | bookmark me | Subscribe to my feed | Add stats to your blog

Tags: | Categories: Ajax Posted by admin on 10/1/2009 11:18 AM | Comments (0)

Download the Ajax ToolKit from http://ajaxControlToolKit.codeplex.com

Add the AJAX Control toolkit into your toolbox, unzip the file and Add a new Tab, choose the items by selecting browse and the DLL AjaxControlToolkit.dll

Using a button Extender as a confirmation button:



asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>  <asp:Button ID="Button1" runat="server" Text="Button" /> <cc2:ConfirmButtonExtender ID="Button1_ConfirmButtonExtender" runat="server" ConfirmText="Are you sure?" Enabled="True" TargetControlID="Button1"> </cc2:ConfirmButtonExtender>


  • To enable the website to use any Ajax control, you need to drag and drop the ScriptManager.

Using an Extender for Textbox to filter characters:

:TextBox ID="TextBox1" runat="server"></asp:TextBox>


<cc2:FilteredTextBoxExtender ID="TextBox1_FilteredTextBoxExtender" runat="server" Enabled="True" TargetControlID="TextBox1" ValidChars="12346789">





Ajax Timer sample:


asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate>


<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>


<asp:Timer ID="Timer1" runat="server" Interval="5000" ontick="Timer1_Tick">












Timer outside the update panel:asp:Timer ID="Timer1" runat="server" Interval="5000" ontick="Timer1_Tick">







<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>






<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />









Tags: | Categories: Blog Posted by admin on 9/24/2009 6:25 PM | Comments (1)

What’s WebsiteSpark? If you are home developer, or an small company, good news for you; all development tools from Microsoft are available to you for 3 years completely free. That includes Visual Studio 2008 Professional Edition with SQL Server 2008 Web Edition. What’s the catch you may ask?

Many years ago, Microsoft went to some companies with the intention of installing their Windows NT servers, they’d provided them for free, if they had to. Of course if Microsoft provided that server for free, you had to retire your old mainframes. They were pretty nice at that time; you now could add your NT server and provide your employees a few PCs to centralize your work, email, files, etc …
The person at Microsoft that came out with that idea should still get a raise every year, this little initiative pay off then as is going to pay off now. The program WebsiteSpark that Scott Guthrie announced a few days ago, I believe,  is going to have as much success as the old NT box in every office. Or for history sake: a PC in every house.
Brining developers to use .NET and Visual Studio 2008/2010 is bringing new extended customers to the Windows world; those companies will have still to purchase servers and software to maintain their releases. Doesn’t stop there, Microsoft is providing 3 years of free development software. I’m in the opinion that the hassle that takes to change development systems is so huge that developers will stay confident in the Microsoft space, that means they’ve trained a developer to become one of their evangelist or at least their customer.
Maybe Microsoft ads are not as good as Apple commercials, yet the idea of one developer at the time has a bright future. The curve of learning .NET and using Visual Studio has a little overhead if you come from the Java/Netbeans/Eclipse space, bigger if you coming from the Linux world. I was amazed to discover the program comes with free online training for the products, of course they want to give you the training, “there ain’t nothing” worse than a frustrated developer in Twitter with the #FAIL hashtag.
In my modest opinion, Microsoft won’t see the fruits of this program in a short time, this is a long time investment to bring those developers right out of college to them as well as those individual consultants or the curious smart guy that is thinking in creating the new Twitter killer app.
Maybe this little announcement from Mr. Guthrie will go unnoticed for a while outside of the geek/nerd space, yet the seeds have been planted, and every person or small company registering for this program is another future Microsoft customer that will bring many other Microsoft customers. Brilliant in every way you look it.
Now there is the concern of destroying competition on the software development, I would like to see more companies like Borland and Novell brining development tools, competition makes those tools better and more appealing to the developer. This Microsoft initiative is going to take a huge bite on the developer market, I hope at least other companies are listening and #monotouch gets a little cheaper ;-)
Tags: | Categories: Ajax Posted by admin on 9/24/2009 2:32 PM | Comments (0)

We covered:

    • Introduction to AJAX. what’s ajax?
    • Basic Concepts and why improves the user experience
    • Basic Sample Website and improving the button with Ajax.
    • What’s the ScriptManager.
    • What’s the UpdatePanel.
    • Partial postback and Full postback.
    • Installing AJAX.

Video: Get Started with ASP.NET AJAX

Microsoft AJAX website

Sample Updating a button and a Label in AJAX.

<form id="form1" runat="server">
               <asp:ScriptManager EnablePartialRendering="true"
                    ID="ScriptManager1" runat="server"></asp:ScriptManager>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                              <asp:Label ID="Label1" runat="server"
                                   Text="This is a label!"></asp:Label>
                              <asp:Button ID="Button1" runat="server"
                                   Text="Click Me" OnClick="Button1_Click" />

The next concepts to learn:

    • Sample AJAX application using XmlHttpObject
    • Convert non Ajax to AJAX
    • Sample Silverlight showing how that technology uses AJAX.
    • How do background postbacks work.
    • How Javascript and ScriptManager works.
    • The ASP.NET Toolkit.
Tags: | Categories: Blog Posted by admin on 9/23/2009 6:41 AM | Comments (1)

CloudCamp is coming to LA on  9/30
CloudCamp is an unconference where early adapters of Cloud Computing technologies exchange ideas. With the rapid change occurring in the industry, we need a place we can meet to share our experiences, challenges and solutions. At CloudCamp, you are encouraged you to share your thoughts in several open discussions, as we strive for the advancement of Cloud Computing. End users, IT professionals and vendors are all encouraged to participate. This camp is cross platform, so come and learn everything you wanted to know about clould computing and how things stack up.
This is a FREE event (except for parking.. see below). And we are limited in the number of attendees so Register soon.
Go here for more information and to register http://www.cloudcamp.com/?page_id=1263
Microsoft Downtown Office (Wells Fargo Tower)
333 South Grand Ave, Suite 3300 (maps)
Los Angeles, CA 90071

Self parking is available at the Pershing Square Garage, on 5th and South Olive St. This underground structure provides 24-hour security parking for $6.00 flat rate after 5:00 p.m. weekdays. And parking may be free if you get your ticket validated at one of the shops.  (Not at the Wells fargo building it is $40.00 to park there and their is NO Validation)

Public Transportation:
Metro Line: You can get here by taking the Metro Red Line, exit Pershing Square station and *exit towards 4th street*. Walk up 4th street, take the big elevator up to California plaza and walk across Grand avenue to
the Wells Fargo entrance.

Tentative Schedule:
5:30pm Registration & Networking
6:00pm Welcome and Thank yous
6:15pm Lightning Talks (5 minutes each)
7:15pm Unpanel
7:45pm Begin Unconference (organize the unconference)
8:00pm Unconference Session - Round 1
9:00pm Unconference Session - Round 2
10:00pm Wrap-up
10:15pm More Networking

Tags: | Categories: Blog Posted by admin on 9/10/2009 2:57 PM | Comments (3)

Tonight I wanted to play a little with the new Managed Extensibility Framework MEF for short library.

A few simple steps to start with MEF.

Download the Managed Extensibility Framework from here

Add a reference to the MEF dll System.ComponentModel.Composition.dll found after unzipping the download at the MEF_Preview_6\bin\SL3


Add a new application to create a new .XAP file


Uncheck the box to link it to .NET RIA Services if its installed in your computer yet keep the link to the Web app without creating the test page. Delete the MainPage.xaml as well as the App.xaml

Add a new UserControl


Add these code to add dynamically the xap file to pull it the app, make sure the new xap file is on the ClientBin directory on the Web tier. Otherwise you’ll have to modify the call to be an absolute path.

var catalog = new PackageCatalog();
          Package.DownloadPackageAsync(new Uri("NewXapFile.xap", UriKind.Relative), (s, p) => catalog.AddPackage(p));

          var container = new CompositionContainer(catalog);

I created the interface and loaded the xap.

Now for the contract to work I had to create a interface and set it like:

    public interface IMyInterface


Inported with a collection

[ImportMany(AllowRecomposition = true)]
       public ObservableCollection<IMyInterfacet> MyInterface { get; set; }


And download it with using it after completed

Package.DownloadPackageAsync(new Uri("My.xap", UriKind.Relative), (s, p) =>

And now you can use the methods inside the user control, happy MEFin’ 

I have many questions after the first application, even that everything works, the piping of the attributes are a little complicated, thanks to Brad Abrams post to help me, yet I have try to avoid using the collection to import the XAP UserControl without any success. I cannot find the reason why we need a collection to import one XAP file class.
Also tomorrow I can see that I would like to play with .XAP files hosted in different servers, not just in the ClientBin directory, so you can use the absolute URL to download the file and run it on your browser, making it more powerful to release different packages around the web, as long as you have the contract or interface.



Follow me in Twitter for updates

Tags: | Categories: Blog Posted by admin on 9/8/2009 5:29 AM | Comments (4)

In Part 2 I introduced the concept of sharing code between tiers. When creating a new class in ASP.NET with the name .shared, .NET RIA Service will generate a hidden class as well in Silverlight with the same code. So you are compiling the code once in each tier, yet they’ll be insync.  This is called the RIA Link.

Now that causes the problem that you are writing server side code that will run in the browser instead of the server, so its important to think about where do you want the code to run.

Executing ASP.NET methods from the Client.

.NET RIA Services also provides a set of Silverlight controls to access data in the Server like the Domain Data Source. This control will send a query on the Silverlight load to consume data from the server and presenting that to the Silverlight tier.


Though you won’t find it on the ToolBox after installing .NET RIA Services, you can add a namespace and type it by hand.

First add the reference to System.Windows.Ria.Controls and recompile the Silverlight application.


Add the namespace on the UserControl:


and once you type the control, intellisense will provide you the rest.

<riaControls:DomainDataSource x:Name="myriaControl" />

Of course you now need to query the data you want to consume using control parameters. Domain Data Sources are very powerful, if you used ASP.NET data sources you’ll be half way there. They give you the ability to sort, filter, edit, paging and grouping as well. I highly recommend you play with them consuming known data to understand further how they work.


Using the .NET RIA Services Class Libraries.

From the July 09 release with .NET RIA Services, the developer can create libraries in ASP.NET that can be also referenced in any Silverlight application. The library will be a single entity and assembly instead of making a copy of itself to be in multiple projects. Yet they’ll be a link between both tiers.

Create a new .NET RIA Services Class library, found on your template with calling New Project



To use this library, you’ll need to Add a Reference from ASP.NET website as well as add the reference to that library from the Silverlight project.

Now that library cannot have references to libraries outside the .NET 3.5 dlls. Adding a COM library will cause a compiling error when .NET RIA Services tries to recompile it to use in Silverlight. Yet there is a huge advantage in using these libraries, yet still the 2 projects that will be generated will exist inside a directory.


The results shows 2 libraries. in a folder. When you select to add a reference for the Web application (ASP.NET) you’ll be able to select the RIA Service Library


Make sure you added in Silverlight as well as ASP.NET.

Now write a method on the Silverlight project just created:



Then in ASP.NET you can see the method:

namespace SilverlightApplicationRIA.Web
    public partial class _Default : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
            RIAServicesLibrary1.Class1 myclass = new RIAServicesLibrary1.Class1();

Easy to now consume methods from Silverlight with ASP.NET. In the Part 2 we saw how to consume ASP.NET data from Silverlight, the sample above is a good example how to consume Silverlight data from the ASP.NET tier.

Site Note:

One thing I haven’t being able to figure it out, if why the .Web project gets created, I thought you can in RIA access that ASP.NET library, so who can access that library created and how is the link established?  I cannot access the 2 classes below I created in Silverlight or ASP.NET.



To answer a few emails: Question) How can I have an application like the business template without Authentication?

To answer people asking me about the business application, you can just use the navigation application template that does not include the .NET RIA services and the Authentication won’t be enable by default.


Visual Studio 2008 will ask you if you want to enable .NET RIA Services, I suggest you to enable that to enjoy the powerful Silverlight and ASP.NET communication, yet the result will be what you are looking for, a template like the one in Part 3 without the Login/Logout controls.




PS: Best resource for .NET RIA Service posted by Brad Abrams

Follow me at Twitter

Tags: | Categories: Blog Posted by admin on 9/4/2009 6:26 AM | Comments (1)

Please read the previous post from this series you can catch up.

I have received many questions about the previous post of how the proxy files actually work. I was looking how .NET RIA Service connects ASP.NET and Silverlight, I was expecting the code that I call from Silverlight using the generated proxy file to call the ASP.NET in the server, yet this is not the case, .NET RIA Service makes a complete copy of the file and compiles it under Silverlight, so all the shared code is just that, 2 different classes, one running in ASP.NET and the other running in Silverlight. That’s why you need to make sure the classes you use in ASP.NET are 3.5 compatible.


Authentication with .NET RIA Services.

Creating a Silverlight application and using the Checkbox to enable that project for ,NET RIA services won’t give you everything you need to use the .NET RIA Services Authentication right now, I do not know if that will change on the release version.

The concept is great, yet, .NET RIA Services is still in development and I believe they haven’t added the “Authentication Domain Service” to secure your Silverlight application with the ASP.NET security context.

For Authentication .NET RIA Service need to be a little different, as need to run on the ASP.NET, even if you call it from Silverlight. So you want to Authenticate a user from Silverlight and you add this code:

namespace SilverlightApplicationRIA
    public partial class MainPage : UserControl
        public MainPage()

            RiaContext.Current.Authentication.Login("al", "pascual");


You’ll receive this error from the .NET RIA Services letting you know you need to create a Context first.

“No contexts have been added to the Application's lifetime objects. For RiaContextBase.Current to resolve correctly, add a single context to the lifetime objects.”


So doesn’t work out of the box, you need to configure ASP.NET with a Membership provider and enable authentication on the web.config. The fastest way is to enable Windows Authentication, then create a Domain Service, go to Add –> New Item and select “Authentication Domain Service”


This is where the problem starts, you won’t be able to find these item in the list. The item is missing on the lastest .NET RIA Service from July sample.


Using the Business Application Template for Security enable application.

So if you want Authentication in .NET RIA Services, you’ll have to create a new project instead of just linking or enabling .NET RIA Services.

Go to create a new project, select Silverlight and “Silverlight Business Application” to create a new application with many things build in for you.


Click to register a new user/.





Upon registration and also login in, Silverlight talks to ASP.NET using .NET RIA Services, the biggest concern for developers is how to prevent the credentials to be seen by anybody as the client needs to send it to the server.

I added Fiddler in the middle to see the communication between the client and the server. Silverlight sends in a post sending the username and password in text.

POST /ria/ClientBin/DataService.axd/BusinessApplication1-Web-AuthenticationService/Login HTTP/1.1
Accept: */*
Content-Length: 58
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0)
Host: alhome
Connection: Keep-Alive
Pragma: no-cache


Works the same way than in ASP.NET with a post into the server, then  is the server that checks the database and does the authentication. So the best way to secure that communication will be using SSL if you do not want to protect the credentials.


Credentials get stored into a File database on ASP.NET.

This template is using the Authentication context to the server

private AuthenticationService _authService = RiaContext.Current.Authentication;


Securing a Silverlight object using Roles in Silverlight and .NET RIA Services.

So this sample will explain using the ESRI Silverlight Map Control, coolest Silverlight control out there, how to protect using Authentication Roles a object in Silverlight.

In the Home UserControl I added the ESRI Silverlight Map and change the visibility depending on the user authentication.

public Home()

            if (RiaContext.Current.Authentication.IsLoggingIn == true)
                MyMap.Visibility = Visibility.Visible;
                MyMap.Visibility = Visibility.Collapsed;

            RiaContext.Current.Authentication.LoggedIn += new EventHandler<System.Windows.Ria.ApplicationServices.AuthenticationEventArgs>(Authentication_LoggedIn);
            RiaContext.Current.Authentication.LoggedOut += new EventHandler<System.Windows.Ria.ApplicationServices.AuthenticationEventArgs>(Authentication_LoggedOut);

        void Authentication_LoggedOut(object sender, System.Windows.Ria.ApplicationServices.AuthenticationEventArgs e)
            MyMap.Visibility = Visibility.Collapsed;

        void Authentication_LoggedIn(object sender, System.Windows.Ria.ApplicationServices.AuthenticationEventArgs e)
            MyMap.Visibility = Visibility.Visible;


As well I register the events for login and logout to make sure I hide the map when the user logout.

You can register a username and password or use:

username: test

password: test123!

This is how .NET RIA Services shows the best way to use Role base security using Silverlight.

Download all the code here


Hope this helps