Embed Silverlight Video Player to Asp.net Web Application [closed]-Collection of common programming errors
Your question is very broad and ambiguous, but I will attempt to provide an answer to what I think you’re looking for:
Assuming you already have an .xap file (that is, the file produced by building a Silverlight Application in Visual Studio 2010), you can simply embed it in any HTML or ASPX page by using the code that Visual Studio automatically generates for you when you create a new Silverlight Application with a Web project:
SilverlightApplication1
html, body {
height: 100%;
overflow: auto;
}
body {
padding: 0;
margin: 0;
}
#silverlightControlHost {
height: 100%;
text-align:center;
}
function onSilverlightError(sender, args) {
var appSource = "";
if (sender != null && sender != 0) {
appSource = sender.getHost().Source;
}
var errorType = args.ErrorType;
var iErrorCode = args.ErrorCode;
if (errorType == "ImageError" || errorType == "MediaError") {
return;
}
var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n" ;
errMsg += "Code: "+ iErrorCode + " \n";
errMsg += "Category: " + errorType + " \n";
errMsg += "Message: " + args.ErrorMessage + " \n";
if (errorType == "ParserError") {
errMsg += "File: " + args.xamlFile + " \n";
errMsg += "Line: " + args.lineNumber + " \n";
errMsg += "Position: " + args.charPosition + " \n";
}
else if (errorType == "RuntimeError") {
if (args.lineNumber != 0) {
errMsg += "Line: " + args.lineNumber + " \n";
errMsg += "Position: " + args.charPosition + " \n";
}
errMsg += "MethodName: " + args.methodName + " \n";
}
throw new Error(errMsg);
}
I had this code automatically generated in VS2010 by going to File->New Project->Silverlight Application and checking the box for “Host the Silverlight Application in a new Web site” and opening up the SilverlightApplication1TestPage.aspx file that was created in my SilverLightApllication1.Web project.