In this article i will explain about how to secure WCF Service on IIS. That is typically an easy requirement but I had a couple of restrictions:

- Only BasicHttpBinding could be used on the client-side - Client credentials (username / password) must be sent and validated with each request

Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application. An endpoint can be a client of a service that requests data from a service endpoint. The messages can be as simple as a single character or word sent as XML, or as complex as a stream of binary data.

One option is to send and validate the credentials as parameters to each method. This method is usually seen as unacceptable because credentials are passed across the service as plain-text. Do you want your password sent over a web service as plain-text? After doing some research, I came up with a solution that is largely a combination of two sources: configuring a WCF service on IIS with SSL and username authentication over BasicHttpBinding… I’ll do my best to consolidate both of those sources for simplicity.Programming / Configuring the WCF Service 1. Open Visual Studio. 2. Create a new ‘WCF Service Application’ project. 3. Define a service interface:

5. Implement a custom credential validator. The class needs to extend the abstract class UserNamePasswordValidator . The important implementation detail here is that you want to throw a FaultException if the credentials are incorrect:using System.IdentityModel.Selectors; using System.ServiceModel; namespace Brett.Service { public class CustomValidator : UserNamePasswordValidator { public override void Validate(string userName, string password) { if (userName != @"hello") { throw new FaultException(@"User name must be 'hello'."); } } } } 6. Edit your web config file. This is probably the most tedious portion of the process. I’ll go ahead and attach the whole file here:<?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <services> <service name="Brett.Service.Service1" behaviorConfiguration="Brett_Behavior"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="Brett_BindingConfiguration" contract="Brett.Service.IService1" /> <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> </service> </services> <bindings> <basicHttpBinding> <binding name="Brett_BindingConfiguration"> <security mode="TransportWithMessageCredential"> <message clientCredentialType="UserName" /> </security> </binding> </basicHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="Brett_Behavior"> <serviceMetadata httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true"/> <serviceCredentials> <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Brett.Service.CustomValidator, Brett.Service"/> </serviceCredentials> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> </configuration> Some important things to note here… We expose two endpoints – one for the BasicHttpBinding and one for service metadata (mex). We are using BasicHttpBinding withTransportWithMessageCredential security (that further specifies a message credential type ofUserName ). The service credentials point to our CustomValidator . This is the absolute minimum needed for me to get the web service working – all elements were needed. 7. Publish the project somewhere local on your machine (right-click project, publish).Configuring IIS for WCF Service with SSL 1. Follow instructions in this guide, until you reach ‘Configure WCF Service for HTTP Transport Security’ (don’t do that part). I would list these out myself, but I think the visuals provided in the link are very helpful. 2. I ended up having some file access issues with my application pool, so I ended up making my application pool run as an administrator identity.Programming / Configuring the WCF Client 1. Open Visual Studio. 2. Create a new ‘Windows Console Application’ project. 3. Add a new service reference – use the location of your WCF Service that is hosted with IIS. The metadata for the service has been downloaded and an app.config file has been produced. We won’t use the app.config. Program the console application to make a call to the service:using Brett.Client.ServiceReference1; using System; using System.ServiceModel; using System.ServiceModel.Description; namespace Brett.Client { class Program { static void Main(string[] args) { var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential); var endpointAddress = new EndpointAddress(@"https://localhost/WhateverYouNamedThis/Service1.svc"); using (var service = new Service1Client(binding, endpointAddress)) { var loginCredentials = new ClientCredentials(); loginCredentials.UserName.UserName = @"hello"; loginCredentials.UserName.Password = @"brett's password"; var defaultCredentials = service.Endpoint.Behaviors.Find<ClientCredentials>(); service.Endpoint.Behaviors.Remove(defaultCredentials); //remove default ones service.Endpoint.Behaviors.Add(loginCredentials); //add required ones var data = service.GetData(100); Console.WriteLine(data); Console.ReadLine(); } } } }

netTcpBinding is a secure, reliable binding suitable for cross-machine communication. It uses TCP for message delivery along with a binary message encoding which makes is faster than HTTP based bindings such as WSHttpBinding and BasicHttpBinding.

Hosting a netTcpBinding service in IIS 7 is simple, however it requires several steps.

2. Make sure the Net.TCP services are running: netTcpBinding uses two windows services. NetTcpActivator - Receives activation requests over the net.tcp protocol and passes them to the Windows Process Activation Service and NetTcpPortSharing - provides ability to share TCP ports over the net.tcp protocol. This service enables net.tcp ports to be shared across multiple user processes which will make it easier to manage open ports in your network.

3. In IIS navigate to your website and select Advanced Settings from the right menu. Add net.tcp to the Enabled Protocols.

4. In IIS select Bindings from the right menu. Add a new net.tcp binding with the port you wish to use. I used port 808 so my Binding information looks like 808:*

5. From now on the system is ready to run netTcpBinding so you can now add it to web.config:

A mexTcpBinding endpoint is needed in order to use IMetadataExchange over TCP. IMetadataExchange exposes methods used to return metadata about a service. Now the service should be up and running so from Visual Studio just add a Service reference. Point the reference to: net.tcp://MyServerIPAddress:808/MyService.svc. It should generate the following configuration

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map. Detailed Error InformationModule StaticFileModule.

4. After run servicemodelreg -i all components will install successfully now run your hosted WCF service will work perfectly.

Reasons whyyou must trustASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to whatASPHostPortaldoes. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL HardwareDell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.- Recovery SystemsRecovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.- Control PanelWe provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.- Excellent Expertise in TechnologyThe reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.- Data CenterASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security- Monitoring ServicesFrom the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.- NetworkASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.- SecurityNetwork security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.- Support ServicesEngineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.

As you can see, I have set a base address of http://localhost:8000 <-- change that to what suits you. Also, I have created 2 endpoints, one uses wsHttpBinding, and the other uses mexHttpBinding

11. Now browse to this URL - http://localhost:8000/HelloWorld.svc, you should see the service hosted as shown below

12. Done. Great job!!

Reasons whyyou must trustASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to whatASPHostPortaldoes. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL HardwareDell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.- Recovery SystemsRecovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.- Control PanelWe provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.- Excellent Expertise in TechnologyThe reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.- Data CenterASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security- Monitoring ServicesFrom the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.- NetworkASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.- SecurityNetwork security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.- Support ServicesEngineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.

This article shows how to deploy a Silverlight application 4 connected to a database. We are going to use IIS 7.5 to do it.

This is the error message:

"System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed fore query 'GetProducts'.... Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed"

And I assume that you have finished your Silverlight app using VS 2010 and .NET Framework 4.0. We have a few views and an MDF database in our App_Data folder. It would look like this:

Now, we are going to deploy our application. You can see this figure below:

This will open up a dialog window. We can create publishing templates. Let’s just choose the location where we are going to publish our application (our computer, a web server, FTP…). I like to check the “delete existing files in the destination folder before publishing” option. Click the Publish button.

Now we are ready to work with the IIS configuration (I'm using Windows 7).

Let’s open the Windows Start Menu, and type “inetmgr” in the search box. The IIS Manager Window will show up.

Go to the MIME Types.

In the appearing list, we’ll need to include the following types (XAML, XAP, XBAP) as shown in the image below:

Now, in the left menu, let’s go to Sites, and let’s add our Web Site (as default site, virtual directory… based on our own needs). When done, let’s click in our application, like this:

In the menu that appears on the right side, we’ll click the “Advance Configuration” link. Now, in the dialog, we’ll click in “Application Group”, and you’ll notice that a button with three dots will appear on its right. Click that button and you will see another dialog. Select ASP.NET v4.0, as shown in the image below:

If ASP.NET v4.0 is not selected, and you leave DefaultAppPool as I did in the beginning, you will get the following error message every time your application tries to connect with the database: “There is an error in the service with the Get function..”

So, now that we selected our Application Group, let us configure it. In the left panel (back in the IIS Manager Window), right above our Default Site, we’ll see “Application Groups”. Click it. A list will appear in the center panel. Let’s open the ASP.NET v4.0 and select the right framework version. Click ok and select it again, but instead of opening it, this time we’ll go to the right panel, and we’ll click on “Advance Configuration”:

Change the Local System and select Network Service, as shown in the image above. And that’s it! Now we are able to access our data from our Silverlight 4 application without getting any error from the Web Server.

Hope this post can help!!

Reasons whyyou must trustASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to whatASPHostPortaldoes. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL HardwareDell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.- Recovery SystemsRecovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.- Control PanelWe provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.- Excellent Expertise in TechnologyThe reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.- Data CenterASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security- Monitoring ServicesFrom the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.- NetworkASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.- SecurityNetwork security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.- Support ServicesEngineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.

This is always an annoying issue with Silverlight deployment to do with connection strings and domain authorizations. Basically it’s a very generic error that pops up if you’re using the in-built standard asp.net model, such as the RIA services models of .net/silverlight development using aspnet authorization and registration.

Why it can happens?

1. Your development system is using a local SQL Express database which works fine when your on your own machine, but once its online, it’s still trying to find the same LocalSqlServer or localhost, and obviously cant. You can get round this in your web.config, using stuff like: <remove /> <add connectionString=”etc etc”.>

2. Or possibly you have all the connection strings point to the right places, but your new server database doesnt contain all the necessary aspnet tables/framework. Theres some tools that are located in your windows/.net folders, such as aspnet_regiis.exe, which if you search for online, you willl get details on how to use them to automatically configure/update an sqlserver with the all the necessary aspnet objects.

3. You haven not deployed necessary references to the webserver, especially ones such as the System.Web.Ria, System.Web.DomainServices and System.ComponentModel.DataAnnotations. You can select them in your visual studio project and mark the Copy Local propery to True.

4. Also if you have any services mapped from server to client, such as WCF Services, make sure when your publishing to update their bindings/endpoint addresses in the client, as they will be still looking for those services on the localhost development server.

5. Also make sure you use a valid crossdomain.xml and clientaccesspolicy.xml on your web project/deployment. If you do a websearch for these two filenames, you will get lots of examples of various settings to use that might be relevant to your site operation.

The other alternative that you can consider is you can use mix of setting of the correct IIS authentication allowing anonymous and forms, and making sure the default connection strings were update correctly. As for the stuff on our server, please (if possible) remove ASP.NET authorization from your application and please write your own custom authorization, so it’s not even trying to update the local sql server for the inbuilt ASP.NET stuff.

Hope this post can help you.

Reasons whyyou must trustASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to whatASPHostPortaldoes. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL HardwareDell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.- Recovery SystemsRecovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.- Control PanelWe provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.- Excellent Expertise in TechnologyThe reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.- Data CenterASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security- Monitoring ServicesFrom the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.- NetworkASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.- SecurityNetwork security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.- Support ServicesEngineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.

This is the new features in Silverlight 4:1. Webcam and microphone access to allow sharing of video and audio for instance for chat or customer service applications.2. Audio and video local recording capabilities capture RAW video without requiring server interaction, enabling a wide range of end-user interaction and communication scenarios for example video conferencing.3. Bring data in to your application with features such as copy and paste or drag and drop.4. Support conventional desktop interaction models through new features such as right-click context menu.5. Multicast networking, enabling Enterprises to lower the cost of streaming broadcast events such as company meetings and training, interoperating seamlessly with existing Windows Media Server streaming infrastructure.6. Read and write files to the user’s MyDocuments, MyMusic, MyPictures and MyVideos folder (or equivalent for non-windows platforms) for example storage of media files and taking local copies of reports.7. Run other desktop programs such as Office, for example requesting Outlook to send an email, send a report to Word or data to Excel.8. COM automation enables access to devices and other system capabilities by calling into application components; for instance to access a USB security card reader.9. Comprehensive printing support enabling hardcopy reports and documents as well as a virtual print view, independent of screen content.10. The .NET Common Runtime (CLR) now enables the same compiled code to be run on the desktop and Silverlight without change.

Now, you can get all the features with very low cost, only at ASPHostPortal.com. Please visit http://www.asphostportal.com for more information.

In this article we will take this proof of concept and demonstrate how through the use of commanding and binding we can virtually eliminate all code behind and implement to a strong MVVM architectural pattern.

Getting Started

I think few would argue with the value of a strong separation of concerns within the design of an application. Over the last year the MVVM pattern has gained popularity in the Silverlight development community. One of the challenges that developers faced in previous versions of the framework was the lack of commanding support in Silverlight. Without commanding many developers had to write there own attached properties, or worse yet, resort to event handling in their code behind, just to deal with responding to a button being clicked. Today both the button and HyperlinkButton support commanding.

Model-View-ViewModel

Even though our sample application will only be a single page, we will still implement the MVVM pattern to eliminate any code in code behind of our MainPage.xaml. MVVM requires that for every View we have a corresponding ModelView (MV) class. Our View will set its DataContext equal to this class and bind all of the views data through public properties.

In our mainPage.xaml we will initialize our ViewModel class and set our LayoutRoot DataContext to this resource. If our ViewModel required additional context or possibly aservices be injected into its constructor I would opts to use a ViewModel locator that has been stored as a ApplicationResource.

One of the great advantages to commanding is encapsulation. When an application has a function like “Save” its very likely that more then one action can trigger this behavior. In our example we intend to allow the save to be triggered from a button, right click context menu as well a something being dragged to a specific location on the screen. Creating a command has two parts. First we need to write a class that implements the ICommand interface and second expose it through our view model.. The following is the general format of such a class. When I create commands in Silverlight I like to inject my ViewModel in the event I need to check the state of my view before executing the command

In the above snippet there are three requirements when implementing the ICommand interface. First we need to define a function called CanExecute. This will be called to determine if a buttons enabled state is set to true or false. What is great about CanExecute is that it eliminates custom business logic to determine if a command can be fired. The second is an Executemethod that is called when the user clicks a button referenced by the command. All of my “Save” logic will be placed inside of this method. A argument is passed to this method that allows data to be injected into the call. Setting CommandParameter on a Button will define what gets passed during the execute. The last requirement is the CanExecuteChanged event. We can fire this event anytime we want buttons that are bound to this command to re-evaluate there enabled state.

To implement this command in our ViewModel, we need to expose the class as a property.

Once exposed, we can reference the SaveCommand through simple binding applied to the Button’s Command property and CommandParameter. Now each time that a user clicks the “Save” button our command will be fired.

More often than not our command is not needed outside of the context of a single view. If this is the case, we can delegate the implementation of the CanExecute and Execute to the ViewModel. Lets say for example you have a command like “StartCapture” that is only appropriate for a single View. In this scenario its a lot easier to have the business logic directly in the ViewModel than in a separate class.

Using the same ICommand interface, we can create a reusable class that delegates both of these methods. The following is the most popular approach.

To implement this DelegateCommand class we do the following in our ViewModel. Notice how our constructor gets passed two delegates, one for CanExecute and one for Execute. Calling this command from XAML is identical to our SaveCommand class.

One of the things that I think a lot developers forget is that TwoWay binding can be a great way to avoid having to create a command or event handler to respond to a user click. Commands are great, but if you don’t need them don’t use them.

When all you want to do is take some action when a user clicks on an item in a list its very easy to allow a change in the lists SelectedItem to notify other controls. Take for example the list of EffectShader displayed in the image below. When a user clicks on any of the shaders, I want to apply that effect to my rectangle which is displaying my VideoBrush. I can do this entirely using binding applied to both elements.

If we examine the code below, you will see a bunch of bindings. First, our ListBox.ItemSource is bound to an ObservableCollection<Effect> of effects. This allows us to add effects to the ListBox by simply updating our collection. Second, our ListBox.IsEnabled is bound to a property in our ViewModel. Notice the use of TargetNullValue and FallbackValue. These new properties on the binding extension method allow us to override what gets used in the event the property we are binding to is NULL value. In this example we have a ViewModel property that stores a reference to a capture that has been selected in the ListBox of captures. If nothing is selected, the property is null. Since a null is not a boolean, we use TargetNullValue and FallbackValue to ensure we have a true/false response.

Another place we use binding is in the DataTemplate of this list box. Here we will bind both the Effect of the rectangle and its Fill. Our Effect will get bound to the ShaderEffect property of this item being rendered , while the Fill will navigate back to the main DataContext and bind to a property called Brush located within our MainPageViewModel. This property might be a SolidBrush, VideoBrush or even an ImageBrush of an existing capture.

So that ensures that our list of effects looks correct, but how exactly does our rectangle displaying our live webcam video with the correct ShaderEffect applied?

Again we lean on Binding to avoid any procedural code. using ElementName binding we bind the styled buttons Effect property to the SelectedItem of our ListBox of effects. Now each time a user clicks on an item in our list of effects the rectangles will change immediately.

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to whatASPHostPortaldoes. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL HardwareDell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.- Recovery SystemsRecovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.- Control PanelWe provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.- Excellent Expertise in TechnologyThe reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.- Data CenterASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security- Monitoring ServicesFrom the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.- NetworkASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.- SecurityNetwork security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.- Support ServicesEngineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.

1. Go to Start menu.2. Go to Control Panel3. Open Add or Remove programs4. Choose Microsoft Silverlight in Add Remove Programs Dialog box5. Click on Remove6. It asks you for the confirmation7. Click YES to Uninstall the Silverlight

Reasons whyyou must trustASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to whatASPHostPortaldoes. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL HardwareDell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.- Recovery SystemsRecovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.- Control PanelWe provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.- Excellent Expertise in TechnologyThe reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.- Data CenterASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security- Monitoring ServicesFrom the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.- NetworkASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.- SecurityNetwork security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.- Support ServicesEngineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.

About ASPHostPortal.com

We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".

Success for us is something that is continually experienced, not something that is reached. For us it is all about the experience – more than the journey. Life is a continual experience. We see the Internet as being an incredible amplifier to the experience of life for all of us. It can help humanity come together to explode in knowledge exploration and discussion. It is continual enlightenment of new ideas, experiences, and passions