Welcome!

Microsoft Cloud Authors: Andreas Grabner, Stackify Blog, Liz McMillan, David H Deans, Automic 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
SYS-CON Events announced today that MobiDev, a client-oriented software development company, will exhibit at 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. MobiDev is a software company that develops and delivers turn-key mobile apps, websites, web services, and complex software systems for startups and enterprises. Since 2009 it has grown from a small group of passionate engineers and business...
SYS-CON Events announced today that GrapeUp, the leading provider of rapid product development at the speed of business, will exhibit at 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. Grape Up is a software company, specialized in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market acr...
SYS-CON Events announced today that Ayehu will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara California. Ayehu provides IT Process Automation & Orchestration solutions for IT and Security professionals to identify and resolve critical incidents and enable rapid containment, eradication, and recovery from cyber security breaches. Ayehu provides customers greater control over IT infras...
SYS-CON Events announced today that Datanami has been named “Media Sponsor” 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. Datanami is a communication channel dedicated to providing insight, analysis and up-to-the-minute information about emerging trends and solutions in Big Data. The publication sheds light on all cutting-edge technologies including networking, storage and applications, and the...
Artificial intelligence, machine learning, neural networks. We’re in the midst of a wave of excitement around AI such as hasn’t been seen for a few decades. But those previous periods of inflated expectations led to troughs of disappointment. Will this time be different? Most likely. Applications of AI such as predictive analytics are already decreasing costs and improving reliability of industrial machinery. Furthermore, the funding and research going into AI now comes from a wide range of com...
SYS-CON Events announced today that EnterpriseTech has been named “Media Sponsor” 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. EnterpriseTech is a professional resource for news and intelligence covering the migration of high-end technologies into the enterprise and business-IT industry, with a special focus on high-tech solutions in new product development, workload management, increased effi...
In this presentation, Striim CTO and founder Steve Wilkes will discuss practical strategies for counteracting fraud and cyberattacks by leveraging real-time streaming analytics. In his session at @ThingsExpo, Steve Wilkes, Founder and Chief Technology Officer at Striim, will provide a detailed look into leveraging streaming data management to correlate events in real time, and identify potential breaches across IoT and non-IoT systems throughout the enterprise. Strategies for processing massive ...
SYS-CON Events announced today that Conference Guru has been named “Media Sponsor” 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. A valuable conference experience generates new contacts, sales leads, potential strategic partners and potential investors; helps gather competitive intelligence and even provides inspiration for new products and services. Conference Guru works with conference organi...
SYS-CON Events announced today that Cloud Academy named "Bronze Sponsor" of 21st International Cloud Expo which will take place October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara, CA. Cloud Academy is the industry’s most innovative, vendor-neutral cloud technology training platform. Cloud Academy provides continuous learning solutions for individuals and enterprise teams for Amazon Web Services, Microsoft Azure, Google Cloud Platform, and the most popular cloud com...
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 TMC has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo and Big Data at Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Global buyers rely on TMC’s content-driven marketplaces to make purchase decisions and navigate markets. Learn how we can help you reach your marketing goals.
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...
"MobiDev is a Ukraine-based software development company. We do mobile development, and we're specialists in that. But we do full stack software development for entrepreneurs, for emerging companies, and for enterprise ventures," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” 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. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.
We build IoT infrastructure products - when you have to integrate different devices, different systems and cloud you have to build an application to do that but we eliminate the need to build an application. Our products can integrate any device, any system, any cloud regardless of protocol," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA
SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
Multiple data types are pouring into IoT deployments. Data is coming in small packages as well as enormous files and data streams of many sizes. Widespread use of mobile devices adds to the total. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists looked at the tools and environments that are being put to use in IoT deployments, as well as the team skills a modern enterprise IT shop needs to keep things running, get a handle on all this data, and deliver...
The current age of digital transformation means that IT organizations must adapt their toolset to cover all digital experiences, beyond just the end users’. Today’s businesses can no longer focus solely on the digital interactions they manage with employees or customers; they must now contend with non-traditional factors. Whether it's the power of brand to make or break a company, the need to monitor across all locations 24/7, or the ability to proactively resolve issues, companies must adapt to...
SYS-CON Events announced today that Enzu will exhibit at SYS-CON's 21st Int\ernational Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Enzu’s mission is to be the leading provider of enterprise cloud solutions worldwide. Enzu enables online businesses to use its IT infrastructure to their competitive advantage. By offering a suite of proven hosting and management services, Enzu wants companies to focus on the core of their ...
In his session at @ThingsExpo, Eric Lachapelle, CEO of the Professional Evaluation and Certification Board (PECB), provided an overview of various initiatives to certify the security of connected devices and future trends in ensuring public trust of IoT. Eric Lachapelle is the Chief Executive Officer of the Professional Evaluation and Certification Board (PECB), an international certification body. His role is to help companies and individuals to achieve professional, accredited and worldwide re...