Skip to main content
Home Forums General Silverlight Getting Started Getting started...
14 replies. Latest Post by SharpGIS on July 1, 2009.
(0)
ddni_nk
Member
6 points
53 Posts
06-26-2009 5:07 PM |
I have just been given a project as an intern to integrate silverlight controls into an existing company html webpage...
I've opened the files in VS2008 and tried adding a new SL control to the project but it doesn't give me an option to do so.
When I tried creating my own ASP.net Web Application and then adding a SL control it works great. I am able to open the html page and the SL control shows up fine.
Any ideas?
Any assistance regarding this matter will be greatly appreciated.
SharpGIS
Contributor
3387 points
611 Posts
06-27-2009 12:20 AM |
You cannot add Silverlight control to a website. You should instead add a new silverlight project to the visual studio solution, then right-click the website project, edit its settings, go to silverlight and add your silverlight application.
What this does is everytime you build the .xap will be copied to your website. When you do the above steps, it will generate two test pages, which you can delete, but wait a bit. First open the .html testpage, then copy the <object> tag and the <script> tag and copy to the page where you want to add a silverlight element.
paru
164 points
28 Posts
06-29-2009 5:50 AM |
Copy past the HTML on the page that loads the silverlight content into the page where you require it
Again add the silverlight.js also
06-29-2009 12:56 PM |
Thanks for the reply... I tried what you said, by adding a new silverlight project to my vs solution, then copying the <object> and <script> tags into my index.html page where I want to display the silverlight, however this did not work.
When I view the html page in a browser, the silverlight object doesn't appear. It seems to keep trying to load but nothing shows up, the rest of the html portion however does display.
Any ideas on why its not working? One thing I wasn't quite sure about from your last post was when you said to "edit its settings"... I didn't know what you meant by that, maybe you can clarify for me.
Thanks again.
davidezo...
5690 points
875 Posts
06-29-2009 3:39 PM |
Hi,
read these:
06-29-2009 4:40 PM |
06-29-2009 6:03 PM |
Have you configured IIS to set the correct content type for .xap files ?
06-29-2009 6:18 PM |
No I have not...that could very well be the issue. I'm trying to figure out how to do that right now.
06-29-2009 6:38 PM |
SharpGIS: Have you configured IIS to set the correct content type for .xap files ?
Could you point me in the direction of how I can go about doing this?
I already looked in IIS and found that the following types were already present:
But is there any thing else I need to do, because it still doesn't work.
Thanks again!
06-30-2009 12:49 AM |
Run Fiddler (www.fiddlertool.com) and verify that the .xap and .js is requested as expected when you load the page (ensure the requests are there and they are not red)
Your mime mappings looks fine.
06-30-2009 1:01 PM |
I've been testing my project all along in Firefox, but when you told me to use Fiddler I ran it in IE8. In IE I can actually see the spot where the SL control is supposed to be and it does indeed try to load it (this did not happen in Firefox)... So there definitely is some progress here, but it still doesn't load.
I did however receive an error message while running in IE that I didn't get in Firefox:
Webpage error detailsUser Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618)Timestamp: Tue, 30 Jun 2009 16:52:33 UTCMessage: Unhandled Error in Silverlight 2 Application Code: 2104 Category: InitializeError Message: Could not download the Silverlight application. Check web server settings Line: 70Char: 13Code: 0
Again, I've checked MIME types and the three needed are added in there correctly.
How can I fix this? Any ideas?
06-30-2009 1:16 PM |
BTW, running fiddler didnt show any requests for .js or .xap.
Here's the report from fiddler:
.REQUEST { font: 8pt Courier New; color: blue;} .RESPONSE { font: 8pt Courier New; color: green;}
06-30-2009 10:47 PM |
Note that fiddler doesnt by default track requests to localhosts. Try and replace localhost with the machine name. You should see requests for your html page as well.
The error you are getting indicates that it cannot find the .xap fle. My guess is that you dont have it in /ClientBin/SilverlightApplication1.xap
07-01-2009 12:23 PM |
I'm fairly sure that my .xap is in the client bin. Here is what my solution explorer looks like in VS2008, maybe someone can double check if its in the correct location:
http://tinypic.com/r/35iof10/5
Also, regarding changing localhost to machine name, I'm assuming you mean for me to change it in the url when I launch the website?
The original url when I launch the site is this: C:\Users\nk\Desktop\Corp Web Files\ver_0\corpwebfiles_ver0\index.html
Do I change this to: http://dev33/Corp%20Web%20Files/ver_0/corpwebfiles_ver0/index.html
(where dev33 is my machine name)... if so, this didn't work and I received a 404 Not Found page:
Thanks for the help, really appreciate it.
07-01-2009 5:13 PM |
Remove SilverlightApplication1.Web. This project is for testing your silverlight app, but you want your silverlight app to run in the existing website (meaning you don't need that autogenerated web app).
You need the .xap placed in the other website, and you need to reference the .xap in the source property using a correct relative path where it can find that.