views:

152

answers:

3

when I create new silverlight project it asks Host the Silverlight application in a new Website followed by two fields- 1. Name: projectName.web 2. Type: ASP.Net Web Application Project OR Asp.Net Web Site when I uncheck this checkbox VS doen not create projectName.web project but when I check this VS creates two projects 1. projectName-->contains .xaml pages 2. projectName.web--> contains default.aspx page.................. So my question is - Is it must to host silverlight app from a new website(default.aspx page) OR cant we directly host .xaml page? ProjectName.Web project is req.??

A: 

XAML is the markup for defining Silverlight/WPF interfaces. It's not a page itself.

If you want to host a Silverlight application on the web, the application needs to be placed on a page so it can be served to end users.

Justin Niessner
**1.** I have created an silverlight application (i have not selected my application to be hosted from another web application).**2.** Now I created a simple hello world page.**3.** I created virtual directory of my silverlight project in IIS for application hosting.**4.** When I browse MainPage.xaml in loaclhost, it is not running.**>>** I think I shoul run the .xap file to host my application but I dont know haw??? OR Is it necessary to host a silverlight application from a .aspx page??
nectar
A: 

you must host xap file on a web page (aspx or html). here is the html markup for that

    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
      <param name="source" value="mySilverlightFile.xap"/>
      <param name="onError" value="onSilverlightError" />
      <param name="background" value="white" />
      <param name="minRuntimeVersion" value="3.0.40624.0" />
      <param name="autoUpgrade" value="true" />
      <a href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=3.0.40624.0" style="text-decoration:none">
          <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
      </a>
    </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
Arvin Meralpis
A: 

Actually you can't run xap directly from browser. But once you refer your xap file as an object element in you html Silverlight runtine on your client machine get recognize the extension and start a sandbox to host your xbap app in it.

Xap in it self is nothing but a archived assembly which contains all you Silverlight code and assets you included in it.

More details are on: http://forums.silverlight.net/forums/p/166495/378292.aspx

Regards.

Shoaib Shaikh