Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

How to enable XML Script in a Web Forms application

$
0
0

For those of you interested in taking a journey back to the future, here is how you can enable theXML Script declarative language in a modern ASP.NET web application project.

My working setup is Windows 10, Visual Studio Community 2017 and the project is a ASP.NET Application (.NET Framework) using the defaultWeb Forms project template.

To have the browser understand the xml-script type you have to reference thePreviewScript.js file in the ScriptManager control. This file is embedded as a web resource in theMicrosoft.Web.Preview assembly. Interestingly enough, the assembly can still be downloaded officially from Microsoft as part of the Microsoft ASP.NET Futures (May 2007) package. In turn, this package requires ASP.NET AJAX Extensions 1.0 which is available from Microsoft, too.

After having installed ASP.NET AJAX Extensions 1.0 and ASP.NET Futures (in that order) add a reference toMicrosoft.Web.Preview in your project (right click References -> Add reference -> Assemblies -> search for Microsoft.Web.Preview and check it). 

Then, in your master page you can add the following reference in the ScriptManager control:

<asp:ScriptManager runat="server"><Scripts><%--Site Scripts--%><asp:ScriptReference Name="PreviewScript.js" Assembly="Microsoft.Web.Preview" /></Scripts></asp:ScriptManager>

And then in your content web page you can use xml-script declarations, for example:

<script type="text/xml-script"><page xmlns="http://schemas.microsoft.com/xml-script/2005"><components><application load="page_load" /></components></page></script>

And that was it! Have fun.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>