asp.net and silverlight
Last post 05-09-2008 11:30 AM by Kiril_Iliev. 5 replies.
Sort Posts:
04-23-2008 5:01 AM
asp.net and silverlight

I am having problems getting a media player  to work in a aspx web page. I am not sure if I have everything setup correcly (has in the right software installed.) And When I did try to get it to work I get nothing coming up on the screen. I have visual studio 2008 installed with silverlight_sdk and silverlight_chainer. I tried putting the scripts in the head part of my master page but I am not sure if I am gettign the code s in the right places. Also when I converted the video with Expression Encoder I was not left with a default.js file or a manifest.xml file. Not sure if I need these!

 

Can anyone point me in the right direction to gettign this to work I have tried all the tutorials which have  not help!

 

Thanks

Thanks

Dids1234567

Joined on 04-22-2008
U.K
Posts 10
04-25-2008 1:16 AM
Marked as Answer
Re: asp.net and silverlight

Hi:

  Could you paste your current code? Basically you just have to create a new web application and drag a ScriptManager control and a MediaControl from the toolbox to your page. Aspx is like this:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SilverlightApplication23_Web._Default" %>

<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
    TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:MediaPlayer ID="MediaPlayer1" runat="server" Height="240px" Width="320px" MediaSource="http://download.microsoft.com/download/b/1/a/b1acbdab-05be-495c-9e71-ae2bcf0a23d3/WinVideo-Silverlight-GettingStartedwithSilverlight.wmv">
        </asp:MediaPlayer>
    </div>
    </form>
</body>
</html>

Regards

Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Allen Chen – MSFT

Joined on 03-16-2007
Posts 717
05-09-2008 7:36 AM
Re: asp.net and silverlight

I've encountered some issues while implementing my SL project into ASP.NET site.

I have a media element in it. When I run the SL project as a stand alone (or as StartUp project), everything is working as intended. However, when I try to run it through my ASP.NET site my media file doesn't play at all - neither if I initiate my play button control, nor with AutoPlay checked.

What I've done to link them up:

1. I've added a new ASP.NET site to the solution

2. I've added a Silverlight Link to the web site and selected the already existing SL project

3. I've added the needed code - script manager, assembly register, and Silverlight control to my XAP file.

Anybody has encountered something similar?

 

Kiril_Iliev

Joined on 01-08-2008
Posts 13
05-09-2008 8:29 AM
Re: asp.net and silverlight

What is build type for your media file? If the media file is local to your app, and the build type is set to 'None', you will have to copy this file to the ClienBin of your ASP.Net app (next to the xap file).

Hope this helps,
Jim (http://jimmangaly.blogspot.com/)

Please MARK the replies as answers if they answered your question

http://www.identitymine.com/

Jim Mangaly

Joined on 04-21-2008
Kochi, India
Posts 108
05-09-2008 9:32 AM
Re: asp.net and silverlight

Hi Jim,

Yes, I have... When I preview it it gave me the following error in IE:

Message: Sys.InvalidOperationException: ManagedRuntimeError error #4002 in control 'Xaml1': System.Windows.Markup.XamlParseException: AG_E_PARSER_BAD_PROPERTY_VALUE

And this is the DIV where my SL control is sittuated:

<div style="height:100%;">

<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/mPlayer.xap" Version="2.0" Width="100%" Height="100%" />

</div>

Kiril_Iliev

Joined on 01-08-2008
Posts 13
05-09-2008 11:30 AM
Re: asp.net and silverlight

Hm, I've remade in a new project everything from the scratch and it worked a charm.

This has happened to me to other custom .NET controls in VS before. It seems it saves the DLL info somewhere in the project and it overrides it somehow... However, the SL controls create XAP file and DLL files...

Custom .NET controls that I have experience developing them has stored their info somewhere in the web.config file so when I have been cleaning it, everything was working fine... it seems this is not the case with the SL custom controls.

Kiril_Iliev

Joined on 01-08-2008
Posts 13