Tuesday 15 July 2014

asp.net - If no Silverlight, redirect -


I have standard silverlight embedded code to handle SL objects in aspx < If I do not have the SLL installed, how can I modify it?

  & lt; Script type = "text / javascript" & gt; Function on Silverlight Enter (Sender, Args) {var appSource = ""; If (sender! = Null & sender! = 0) {appSource = sender.getHost (). Source; } Var errorType = args.ErrorType; Var iErrorCode = args.ErrorCode; If (errorType == "Image Error" || Error Type == "MediaAire") {Return; } Var errMsg = "Unlocked error in Silverlight application" + + + apps \ "\ n"; ErrMsg + = "Code:" + iErrorCode + "\ n"; ErrMsg + = "Category:" + ErrorType + "\ n"; ErrMsg + = "Message:" + args.ErrorMessage + "\ n"; If (errorType == "ParserError") {errMsg + = "File:" + argsxamlFile + "\ n"; ErrMsg + = "Line:" + argslineNumber + "\ n"; ErrMsg + = "Status:" + args.charPosition + "\ n"; } And if (error type == "runtime error") {if (args.lineNumber! = 0) {errMsg + = "line:" + argslineNumber + "\ n"; ErrMsg + = "Status:" + args.charPosition + "\ n"; } ErrMsg + = "Lawname:" + args.methodName + "\ n"; } Throw a new error (errMsg); } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form id = "form1" runat = "server" style = "height: 100% width width: 100%; & Gt; & Lt; Div id = "silverlightcontrolhost" & gt; & Lt; Object Data = "Data: App / X-Silverlight-2," Type = "App / X-Relilite-2" width = "100%" height = "100%" & gt; & Lt; Param name = "source" value = "ClientBin / SL.xap" /> & Lt; Param name = "onError" value = "onSilverlight error" /> & Lt; Param name = "background" value = "white" /> & Lt; Param name = "minRuntimeVersion" value = "5.0.61118.0" /> & Lt; Param name = "auto upgrade" value = "true" /> & Lt; A href = "http://go.microsoft.com/fwlink/?LinkID=149156&v=5.0.61118.0" style = "text-decoration: none" & gt; & Lt; Img src = "http://go.microsoft.com/fwlink/?LinkId=161376" alt = "get Microsoft Silverlight" style = "border-style: none" /> & Lt; / A & gt; & Lt; / Object & gt; & Lt; Iframe id = "_ sl_historyFrame" style = "visibility: hidden; height: 0 pixel; width: 0 pixel; range: 0px" & gt; & Lt; / Iframe & gt; & Lt; / Div & gt; & Lt; / Form & gt; & Lt; / Body & gt;    

Try redirecting to ASPX page instead of that JavaScript method body < / P>

For example:

  & lt ;! DOCTYPE html & gt; & Lt; Html lang = "en" xmlns = "http://www.w3.org/1999/xhtml" & gt; & Lt; Top & gt; & Lt; Script type = "text / javascript" & gt; Function on Silverlight Enter (Sender, Args) {window.location.assign ("http://www.stackoverflow.com/"); } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form id = "form1" runat = "server" style = "height: 100% width width: 100%; & Gt; & Lt; Div id = "silverlightcontrolhost" & gt; & Lt; Object Data = "Data: App / X-Silverlight-2," Type = "App / X-Relilite-2" width = "100%" height = "100%" & gt; & Lt; Param name = "source" value = "ClientBin / SL.xap" /> & Lt; Param name = "onError" value = "onSilverlight error" /> & Lt; Param name = "background" value = "white" /> & Lt; Param name = "minRuntimeVersion" value = "5.0.61118.0" /> & Lt; Param name = "auto upgrade" value = "true" /> & Lt; A href = "http://go.microsoft.com/fwlink/?LinkID=149156&v=5.0.61118.0" style = "text-decoration: none" & gt; & Lt; Img src = "http://go.microsoft.com/fwlink/?LinkId=161376" alt = "get Microsoft Silverlight" style = "border-style: none" /> & Lt; / A & gt; & Lt; / Object & gt; & Lt; Iframe id = "_ sl_historyFrame" style = "visibility: hidden; height: 0 pixel; width: 0 pixel; range: 0px" & gt; & Lt; / Iframe & gt; & Lt; / Div & gt; & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;    

No comments:

Post a Comment