简体   繁体   中英

To Host Silverlight Application on a Classic ASP page

Is it possible to host a silverlight application on a classic asp page? I see examples where the silverlight application is hosted on a html page, and I do understand that Silverlight is a client side language, but since I need to pass data from the page to the silverlight application, I am not too sure what to do.

PS: the silverlight application is also database driven, so it will be connected to the database, and I have searched Google and nothing found, only be able to find Silverlight with ASP.net.

Can anyone help me?

Thanks

You can host Silverlight in HTML.

MSDN - Hosting Silverlight in the browser

Silverlight can exist on any HTML page (classic ASP or other). It uses an tag to host so as long as you're outputting HTML, you're fine.

You can probably do what you want via the initParams parameter, at least as far as sending data from the page to the Silverlight app at load time. If you're setting it from the server, you can just do something like: (forgive syntax errors, I don't know classic ASP)

<object type="application/x-silverlight-2" data="data:application/x-silverlight," ... >
    <param name="initParams" value="<% Response.Write("foo=bar,bin=baz") %>" />
</object>

Connecting to the database should be exposed via a webservice. You probably don't want your users connecting directly to your database anyways. It doesn't really matter what your service is implemented in, you should still be able to consume it in your Silverlight application.

As others have pointed out hosting the Silverlight control itself in an ASP pages is a doddle. However I suspect your main issue is where you say "the silverlight application is also database driven, so it will be connected to the database". Now that is much trickier if you can only use classic ASP on the server.

Initially I would say why not create an ASP.NET application to host some WCF or ADO.NET Data Service to supply the SL app with its data.

Failing that if your back end must strictly be ASP classic only then you aren't going to find examples of ASP to Silverlight. However you should be able to find examples of creating SOAP based web services and WSDL stuff in classic ASP. You should also be able to find examples of creating Silverlight apps that consume SOAP/WSDL backed services. You can then stich these two skills together.

I must stress though you would be better off using and ASP.NET backed for the data access. This does not require that you upgrade all your existing ASP code right now to ASP.NET, you just create a sub-application in ASP.NET to bind to the SL app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM