Welcome!

Microsoft Cloud Authors: David H Deans, Yeshim Deniz, Janakiram MSV, Andreas Grabner, Stackify Blog

Related Topics: Microsoft Cloud, Linux Containers, Machine Learning , Silverlight

Microsoft Cloud: Article

Deploying an ASP.NET AJAX RSS Reader on Linux

Unleash your creativity

The RSS Reader project uses the Visual Studio Web Site format, which was the default project format in Visual Studio 2005 (sans SP1). For Grasshopper to work with the project, first convert the Website into the Web Application project type:
  1. In Visual Studio, create a new “RSSReader” project from the Visual C# for Java EE > ASP.NET AJAX-enabled Web application template. Grasshopper adds two new project types to Visual Studio’s New Project dialog: Visual C# for Java EE and Visual Basic for Java EE.
  2. Open the RSS Reader Web site in the same solution.
  3. Drag-and-drop all project files (except for the references) from the Website to the RSSReader project, overwriting any default items.
  4. Right-click the RSSReader project node in the Solution Explorer and select Convert to Web Application.

The RSS Reader uses version 1.0.0.1 of the ASP.NET RSS Toolkit. Since the download package from CodePlex does not include any Visual Studio project file, create a new .NET class library project (“RSSToolkit”) from the source code and add it to the solution. To build RSS Toolkit, you also need to add references to System.Configuration, System.Design, System.Drawing, System.Web and System.Windows.Forms to the class library project. Verify that the build succeeds and then generate a Grasshopper project from RSS Toolkit.

Grasshopper adds a new context menu item to Solution Explorer’s project nodes: Generate Java EE Project. Choosing this option for the RSSToolkit project brings up a wizard that analyzes project dependencies and suggests alternatives for unresolved references. In this case, because the RSS Toolkit doesn’t have any non-framework dependencies, the wizard does not present any options. When finished, a new project is created in your solution: RSSToolkit.JavaEE.

Now, add a reference from RSSReader to the Java-version of RSSToolkit by selecting Add Java Reference... (another new menu item added by Grasshopper, see Figure 1) and select RSSToolkit.JavaEE from the Project tab.

Remove the .NET versions of the Web site and the RSS Toolkit project from the solution because they are no longer required.

Building for Java
If you try to build the newly generated Java projects, you’ll see errors referring to classes and methods that are “not supported.” Due to the fundamental differences between the .NET and Java platforms, there are some limitations in the Java runtime libraries used to implement the .NET Framework. These limitations are responsible for the build errors above, and they are caught when Grasshopper validates the .NET code.

To build the application successfully, modify the source code to use only supported methods and classes. When targeting the Java platform, the full Java Framework is callable from Visual C# or Visual Basic code, so you always have the choice of either using supported .NET classes and methods, or using the Java Framework. If you’re looking to maintain a single source code base for targeting both platforms, use the conditional compilation directives (#if JAVA) to separate sections that are unique to .NET or Java.

In the sample application, the errors you see are due to the usage of BuildProvider, which is unsupported due to its tight coupling to System.CodeDom. Inspect the RSS Toolkit classes that are generating errors and see that they are only needed for generating RSS feeds, and not for consuming them – which is the only requirement in the RSS Reader. The pragmatic solution here is to ignore the three classes that are responsible for generating RSS when building for Java. There are two ways to accomplish this, and the choice between them is more a matter of style than anything else. You can either exclude the files from the RSSToolkit.JavaEE project, or wrap them with a preprocessor directive:

#if !JAVA
// .NET specific code goes here
#endif

You also need to wrap the code accessing these classes with the #if !JAVA directive.

Another issue to keep in mind when moving from the .NET platform to Java is that you need to use the correct case for file names, because .NET and Windows don’t distinguish between lowercase or uppercase, while Java does.

Using ASP.NET AJAX in Grasshopper
The RSS Reader also depends on the AJAX Control Toolkit, a joint project between Microsoft and the developer community. Grasshopper provides full support for the AJAX Control Toolkit (as well as the Anthem.NET AJAX Toolkit), and comes bundled with the ported source code. To reference the AJAX Control Toolkit, open the project (by default available at C:\Program Files\Mainsoft for Java EE\Samples\CS\Tomcat\AjaxControlToolkit\), build it with Grasshopper, and add the output AjaxControlToolkit.jar file to your project’s references with the Add Java Reference... option. Make sure the assembly file (AjaxControlToolkit.dll) resides in the same folder as the .jar file.

The original RSS Reader project used a preview release of ASP.NET AJAX, and as such contains the tagMapping element in Web.config for enabling the AJAX validators. These types were removed from the official release of ASP.NET AJAX. To correct the problem, simply remove the tagMapping element from Web.config.

This time, the build succeeds. Start the Grasshopper bundled Tomcat server from Start > All Programs > Mainsoft for Java EE > Start Tomcat and run the application from Visual Studio with Ctrl-F5. Voilà! Tomcat runs the Java application, which was ported from ASP.NET.

Of course, this conversion is a one-time process. Now, you can continue to develop the source code in Visual C# or Visual Basic inside Visual Studio, as you would any .NET application, taking advantage of Visual Studio’s visual designer, debugger, IntelliSense, and other development features.

Adding new AJAX functionality to the RSS Reader for Java is virtually the same process as adding AJAX controls to an ASP.NET application deployed on Windows. As an example, use the AnimationExtender to blur the feed list when the mouse cursor isn’t hovering over it.

For the AJAX AnimationExtender control to be able to access the feed list, wrap it with an ASP.NET control; <asp:panel> serves this purpose well. Drag-and-drop the AnimationExtender control to the Default.aspx page’s design surface in Visual Studio and set its TargetControlID property to the ID of the <asp:Panel>. Now, define the animations for fading the list in and out on specific events:

<ajaxT:AnimationExtender ID=”AnimationExtender1”
runat=”server” TargetControlID=”FeedList”>
<Animations>
<OnLoad>
<FadeOut MinimumOpacity=”.2” />
</OnLoad>
<OnHoverOver>
<FadeIn MinimumOpacity=”.2” Duration=”.3” />
</OnHoverOver>
<OnHoverOut>
<FadeOut MinimumOpacity=”.2” />
</OnHoverOut>
</Animations>
</ajaxT:AnimationExtender>

While you’re at it, also replace the “(read more)” link to the full article text with an Ajaxy HoverMenu. Drag-and-drop the HoverMenuExtender control, also found in the AJAX Control Toolkit, to the DataList’s Item Template. Then, drop a HyperLink control there and databind the NavigateUrl property to the item’s link value:

<asp:HyperLink ID=”Popup” runat=”server”
BackColor=Beige BorderColor=DarkKhaki
Text=”View Original Item” NavigateUrl=’<%#
Eval(“link”)%>’/>
<ajaxT:HoverMenuExtender TargetControlID=”panelHeader” runat=”server”
PopupControlID=”Popup” PopupPosition=Right OffsetX=15 />

Finally, build and run the application to see that the changes work.

Deploying on Linux
So far, you have deployed the Java build target on the Grasshopper-bundled Tomcat Web application server, running locally on Windows. Now, let’s fulfill our promise to run this Web application on Linux. This is a straightforward process. First, build the Release_Java configuration of RSSReader to create a deployment-friendly WAR file.

The release configuration’s default setting enables Full Deployment Package (WAR) (a Grasshopper-specific project property) and tells the build system to generate a Web Archive (WAR) file, a compressed archive with all needed resources (HTML, JAR, images files, etc.).

Then, upload the WAR file to Tomcat on Linux via Tomcat Manager’s Web administration interface. The WAR file created in the previous step is located inside the local Tomcat’s installation directory, by default at C:\Program Files\Mainsoft for Java EE\jakarta-tomcat\webapps\.

Figure 2 shows the ASP.NET AJAX application hosted on Linux/Apache Tomcat.

Summary
This article shows you how to use ASP.NET AJAX to build applications for Linux, which is a very practical tool for multi-platform deployments. But we’re only scraping the surface of Grasshopper’s full potential to enable.NET–Java interoperability here. Unleash your creativity and use the power of Visual Studio development and the ASP.NET Framework to deploy Web applications to open source Web application servers!

More Stories By Jonas Martinsson

Jonas Martinsson is an entrepreneur and a member of Mainsoft's development team. He helped to integrate Mainsoft's .NET-Java EE interoperability products with the Visual Studio IDE.

Comments (2) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Jonas Martinsson 05/27/08 04:24:47 AM EDT

Prasanna, you can download the project source code at http://dev.mainsoft.com/Portals/0/Downloads/RSSReader.zip

Prasanna 05/22/08 09:22:37 AM EDT

Liked the article "Deploying an ASP.NET AJAX RSS Reader on Linux", if you could provide the document a little more detailed with sample examples, that might have been a great value add

@ThingsExpo Stories
In his session at @ThingsExpo, Dr. Robert Cohen, an economist and senior fellow at the Economic Strategy Institute, presented the findings of a series of six detailed case studies of how large corporations are implementing IoT. The session explored how IoT has improved their economic performance, had major impacts on business models and resulted in impressive ROIs. The companies covered span manufacturing and services firms. He also explored servicification, how manufacturing firms shift from se...
WebRTC is the future of browser-to-browser communications, and continues to make inroads into the traditional, difficult, plug-in web communications world. The 6th WebRTC Summit continues our tradition of delivering the latest and greatest presentations within the world of WebRTC. Topics include voice calling, video chat, P2P file sharing, and use cases that have already leveraged the power and convenience of WebRTC.
SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
SYS-CON Events announced today that Secure Channels, a cybersecurity firm, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Secure Channels, Inc. offers several products and solutions to its many clients, helping them protect critical data from being compromised and access to computer networks from the unauthorized. The company develops comprehensive data encryption security strategie...
An increasing number of companies are creating products that combine data with analytical capabilities. Running interactive queries on Big Data requires complex architectures to store and query data effectively, typically involving data streams, an choosing efficient file format/database and multiple independent systems that are tied together through custom-engineered pipelines. In his session at @BigDataExpo at @ThingsExpo, Tomer Levi, a senior software engineer at Intel’s Advanced Analytics ...
Internet-of-Things discussions can end up either going down the consumer gadget rabbit hole or focused on the sort of data logging that industrial manufacturers have been doing forever. However, in fact, companies today are already using IoT data both to optimize their operational technology and to improve the experience of customer interactions in novel ways. In his session at @ThingsExpo, Gordon Haff, Red Hat Technology Evangelist, shared examples from a wide range of industries – including en...
Detecting internal user threats in the Big Data eco-system is challenging and cumbersome. Many organizations monitor internal usage of the Big Data eco-system using a set of alerts. This is not a scalable process given the increase in the number of alerts with the accelerating growth in data volume and user base. Organizations are increasingly leveraging machine learning to monitor only those data elements that are sensitive and critical, autonomously establish monitoring policies, and to detect...
"We're a cybersecurity firm that specializes in engineering security solutions both at the software and hardware level. Security cannot be an after-the-fact afterthought, which is what it's become," stated Richard Blech, Chief Executive Officer at Secure Channels, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. Jack Norris reviews best practices to show how companies develop, deploy, and dynamically update these applications and how this data-first...
Intelligent Automation is now one of the key business imperatives for CIOs and CISOs impacting all areas of business today. In his session at 21st Cloud Expo, Brian Boeggeman, VP Alliances & Partnerships at Ayehu, will talk about how business value is created and delivered through intelligent automation to today’s enterprises. The open ecosystem platform approach toward Intelligent Automation that Ayehu delivers to the market is core to enabling the creation of the self-driving enterprise.
The question before companies today is not whether to become intelligent, it’s a question of how and how fast. The key is to adopt and deploy an intelligent application strategy while simultaneously preparing to scale that intelligence. In her session at 21st Cloud Expo, Sangeeta Chakraborty, Chief Customer Officer at Ayasdi, will provide a tactical framework to become a truly intelligent enterprise, including how to identify the right applications for AI, how to build a Center of Excellence to ...
SYS-CON Events announced today that Massive Networks will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Massive Networks mission is simple. To help your business operate seamlessly with fast, reliable, and secure internet and network solutions. Improve your customer's experience with outstanding connections to your cloud.
SYS-CON Events announced today that Datera, that offers a radically new data management architecture, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Datera is transforming the traditional datacenter model through modern cloud simplicity. The technology industry is at another major inflection point. The rise of mobile, the Internet of Things, data storage and Big...
Because IoT devices are deployed in mission-critical environments more than ever before, it’s increasingly imperative they be truly smart. IoT sensors simply stockpiling data isn’t useful. IoT must be artificially and naturally intelligent in order to provide more value In his session at @ThingsExpo, John Crupi, Vice President and Engineering System Architect at Greenwave Systems, will discuss how IoT artificial intelligence (AI) can be carried out via edge analytics and machine learning techn...
Everything run by electricity will eventually be connected to the Internet. Get ahead of the Internet of Things revolution and join Akvelon expert and IoT industry leader, Sergey Grebnov, in his session at @ThingsExpo, for an educational dive into the world of managing your home, workplace and all the devices they contain with the power of machine-based AI and intelligent Bot services for a completely streamlined experience.
In his session at @ThingsExpo, Arvind Radhakrishnen discussed how IoT offers new business models in banking and financial services organizations with the capability to revolutionize products, payments, channels, business processes and asset management built on strong architectural foundation. The following topics were covered: How IoT stands to impact various business parameters including customer experience, cost and risk management within BFS organizations.
SYS-CON Events announced today that CA Technologies has been named "Platinum Sponsor" of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business - from apparel to energy - is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
From 2013, NTT Communications has been providing cPaaS service, SkyWay. Its customer’s expectations for leveraging WebRTC technology are not only typical real-time communication use cases such as Web conference, remote education, but also IoT use cases such as remote camera monitoring, smart-glass, and robotic. Because of this, NTT Communications has numerous IoT business use-cases that its customers are developing on top of PaaS. WebRTC will lead IoT businesses to be more innovative and address...
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
WebRTC is great technology to build your own communication tools. It will be even more exciting experience it with advanced devices, such as a 360 Camera, 360 microphone, and a depth sensor camera. In his session at @ThingsExpo, Masashi Ganeko, a manager at INFOCOM Corporation, will introduce two experimental projects from his team and what they learned from them. "Shotoku Tamago" uses the robot audition software HARK to track speakers in 360 video of a remote party. "Virtual Teleport" uses a...