Click here to Skip to main content
15,885,278 members
Articles / Desktop Programming / MFC

How to Use ASP.NET “Property Pages” to create or host a Silverlight application in ASP.NET Site?

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
25 Nov 2010CPOL2 min read 15K   1  
How to Use ASP.NET “Property Pages” to create or host a Silverlight application in ASP.NET Site?

While creating a Silverlight application in Visual Studio 2010, after providing the application name, IDE asked for whether you want to host the Silverlight application in a new ASP.NET web site or not. If you select the “Ok” button , Visual Studio will create a ASP.NET site to host the corresponding Silverlight Application. So whenever you will run the Silverlight application, ASP.NET site will automatically host the Silverlight file. But suppose you have an existing Silverlight Application and you want to host it in an ASP.NET site in a similar way that New Silverlight project does or you want to add a new Silverlight application which will automatically host inside your current ASP.NET web site? Do you know we can easily achieve this using “Property Pages” of an ASP.NET Application. Let’s explore how we can do that.

Let’s consider that you have an existing Silverlight application and you want to host it in an ASP.NET Web site.

2

In the first place, you have to add a new ASP.NET application in the same solution. Then Right click on ASP.NET Application and select “Property Page” (Shift +F4) from Context menu.

3

Once you select the Property Pages, the below screen will appear:

4

Select “Silverlight Applications” from the left side list and Click on “Add” button. On the click of “Add” button, the below screen “Add Silverlight Application” will appear.

5

There you will have two options:

  1. Use an existing Silverlight Project in Solution
  2. Create a new Silverlight Project and add it to solution

As we are going to host an existing Silverlight application, we will go with the first option. From the project dropdown (if you have more than one, you can select any of them), select the Silverlight Project and Click on “Add”. You are done. This process will do all the required steps for you to host the Silverlight Application. If you go back to your solution explorer, you will find ClientBin folder and a few new files are added with ASP.NET site along with ASP.NET and HTML Test pages.

6

Now, if you run your Silverlight application, it will be hosted inside a newly created ASP.NET site.

Now, in the second scenario, You have an ASP.NET site and you want to add a new Silverlight Project which will automatically host the newly created application. The process is quite similar, in this case from property pages, instead of Existing Silverlight project option, you have to select “Create a new Silverlight Project and add it to solution”.

7

This will add a new Silverlight Application with your web site.

8

Summary

In this blog post, I have explained how we can use ASP.NET “Property Pages” to create or host an existing Silverlight application in the ASP.NET site.

Hope this will help you.

Thanks!

AJ

Shout it


Filed under: ASP.NET 4.0, General, Silverlight 4, Visual Studio 2010

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
India India
.NET Consultant | Former Microsoft MVP - ASP.NET | CodeProject MVP, Mentor, Insiders| Technology Evangelist | Author | Speaker | Geek | Blogger | Husband

Blog : http://abhijitjana.net
Web Site : http://dailydotnettips.com
Twitter : @AbhijitJana
My Kinect Book : Kinect for Windows SDK Programming Guide

Comments and Discussions

 
-- There are no messages in this forum --