Welcome!

Microsoft Cloud Authors: Stackify Blog, Liz McMillan, David H Deans, Automic Blog, Pat Romanski

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
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
SYS-CON Events announced today that Hitachi, the leading provider the Internet of Things and Digital Transformation, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Hitachi Data Systems, a wholly owned subsidiary of Hitachi, Ltd., offers an integrated portfolio of services and solutions that enable digital transformation through enhanced data management, governance, mobility and analytics. We help globa...
SYS-CON Events announced today that CollabNet, a global leader in enterprise software development, release automation and DevOps solutions, will be a Bronze Sponsor of SYS-CON's 20th International Cloud Expo®, taking place from June 6-8, 2017, at the Javits Center in New York City, NY. CollabNet offers a broad range of solutions with the mission of helping modern organizations deliver quality software at speed. The company’s latest innovation, the DevOps Lifecycle Manager (DLM), supports Value S...
The 20th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held June 6-8, 2017, at the Javits Center in New York City, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Containers, Microservices and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal ...
SYS-CON Events announced today that Super Micro Computer, Inc., a global leader in compute, storage and networking technologies, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Supermicro (NASDAQ: SMCI), the leading innovator in high-performance, high-efficiency server technology, is a premier provider of advanced server Building Block Solutions® for Data Center, Cloud Computing, Enterprise IT, Hadoop/...
Amazon has gradually rolled out parts of its IoT offerings in the last year, but these are just the tip of the iceberg. In addition to optimizing their back-end AWS offerings, Amazon is laying the ground work to be a major force in IoT – especially in the connected home and office. Amazon is extending its reach by building on its dominant Cloud IoT platform, its Dash Button strategy, recently announced Replenishment Services, the Echo/Alexa voice recognition control platform, the 6-7 strategic...
With billions of sensors deployed worldwide, the amount of machine-generated data will soon exceed what our networks can handle. But consumers and businesses will expect seamless experiences and real-time responsiveness. What does this mean for IoT devices and the infrastructure that supports them? More of the data will need to be handled at - or closer to - the devices themselves.
New competitors, disruptive technologies, and growing expectations are pushing every business to both adopt and deliver new digital services. This ‘Digital Transformation’ demands rapid delivery and continuous iteration of new competitive services via multiple channels, which in turn demands new service delivery techniques – including DevOps. In this power panel at @DevOpsSummit 20th Cloud Expo, moderated by DevOps Conference Co-Chair Andi Mann, panelists will examine how DevOps helps to meet th...
@GonzalezCarmen has been ranked the Number One Influencer and @ThingsExpo has been named the Number One Brand in the “M2M 2016: Top 100 Influencers and Brands” by Analytic. Onalytica analyzed tweets over the last 6 months mentioning the keywords M2M OR “Machine to Machine.” They then identified the top 100 most influential brands and individuals leading the discussion on Twitter.
Judith Hurwitz is president and CEO of Hurwitz & Associates, a Needham, Mass., research and consulting firm focused on emerging technology, including big data, cognitive computing and governance. She is co-author of the book Cognitive Computing and Big Data Analytics, published in 2015. Her Cloud Expo session, "What Is the Business Imperative for Cognitive Computing?" is scheduled for Wednesday, June 8, at 8:40 a.m. In it, she puts cognitive computing into perspective with its value to the busin...
Five years ago development was seen as a dead-end career, now it’s anything but – with an explosion in mobile and IoT initiatives increasing the demand for skilled engineers. But apart from having a ready supply of great coders, what constitutes true ‘DevOps Royalty’? It’ll be the ability to craft resilient architectures, supportability, security everywhere across the software lifecycle. In his keynote at @DevOpsSummit at 20th Cloud Expo, Jeffrey Scheaffer, GM and SVP, Continuous Delivery Busine...
In his general session at 19th Cloud Expo, Manish Dixit, VP of Product and Engineering at Dice, discussed how Dice leverages data insights and tools to help both tech professionals and recruiters better understand how skills relate to each other and which skills are in high demand using interactive visualizations and salary indicator tools to maximize earning potential. Manish Dixit is VP of Product and Engineering at Dice. As the leader of the Product, Engineering and Data Sciences team at D...
Cognitive Computing is becoming the foundation for a new generation of solutions that have the potential to transform business. Unlike traditional approaches to building solutions, a cognitive computing approach allows the data to help determine the way applications are designed. This contrasts with conventional software development that begins with defining logic based on the current way a business operates. In her session at 18th Cloud Expo, Judith S. Hurwitz, President and CEO of Hurwitz & ...
SYS-CON Events announced today that Juniper Networks (NYSE: JNPR), an industry leader in automated, scalable and secure networks, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Juniper Networks challenges the status quo with products, solutions and services that transform the economics of networking. The company co-innovates with customers and partners to deliver automated, scalable and secure network...
The explosion of new web/cloud/IoT-based applications and the data they generate are transforming our world right before our eyes. In this rush to adopt these new technologies, organizations are often ignoring fundamental questions concerning who owns the data and failing to ask for permission to conduct invasive surveillance of their customers. Organizations that are not transparent about how their systems gather data telemetry without offering shared data ownership risk product rejection, regu...
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 across the USA and Europe, we work with a variety of customers from emerging startups to Fortune 1000 companies.
Financial Technology has become a topic of intense interest throughout the cloud developer and enterprise IT communities. Accordingly, attendees at the upcoming 20th Cloud Expo at the Javits Center in New York, June 6-8, 2017, will find fresh new content in a new track called FinTech.
With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend @CloudExpo | @ThingsExpo, June 6-8, 2017, at the Javits Center in New York City, NY and October 31 - November 2, 2017, Santa Clara Convention Center, CA. Learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
SYS-CON Events announced today that Interoute, owner-operator of one of Europe's largest networks and a global cloud services platform, has been named “Bronze Sponsor” of SYS-CON's 20th Cloud Expo, which will take place on June 6-8, 2017 at the Javits Center in New York, New York. Interoute is the owner-operator of one of Europe's largest networks and a global cloud services platform which encompasses 12 data centers, 14 virtual data centers and 31 colocation centers, with connections to 195 add...
The age of Digital Disruption is evolving into the next era – Digital Cohesion, an age in which applications securely self-assemble and deliver predictive services that continuously adapt to user behavior. Information from devices, sensors and applications around us will drive services seamlessly across mobile and fixed devices/infrastructure. This evolution is happening now in software defined services and secure networking. Four key drivers – Performance, Economics, Interoperability and Trust ...