CoverYourASP --> Get the News, Part 1

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
41 active users
2337 visitors today
2025 pages today
(only part of today)
Tools I use

CoverYourASP
Copyright © 1999-2016 James Shaw.
All rights reserved.

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

This article describes how I wrote an MFC application to put ASPWire's news feed onto my site. Here it is:

• Amazing New ASP Template Pack
• A/V Publisher
• fXgraph Ver 4 Beta Animated Graphing Comp Released
• CompareFilesX now has reporting built in
• CodeCharge Studio ASP code generator Released
• URLDecode Function
• An Extensive Examination of the DataGrid Web Control: Part 5
• Protecting Portions of your Web Site
• Specifying Configuration Settings in Web.config
News from ASPWire
Powered by ASPWire
Read how this is done

Their instructions were simple enough: Get the raw news data from a given ASP page (no more than 4 times a day), create an ASP file with the formatted news in it, and #include it on your page. Here's how I did just that.

First, there were a few restrictions. My site is hosted by a local ISP, and the initial idea of writing a COM component to do the work had a few problems. Remember that the component could only get the content no more than 4 times a day. So the component needed to be called by some scheduling service - something my ISP may not want to do.

The component would also need write permissions to a folder on my site so I could write the ASP file, again maybe not a good idea.

The answer was to write an MFC application (an .exe) that runs on my computer. It gets the data, formats it, then FTP's the file to my ISP. I therefore had full control over when the application ran, and could easily debug and modify it as necessary.

Creating the App using the MFC AppWizard.
Creating the application is trivial using Visual C++ v6.0.

• Use File/New, and select MFC AppWizard (exe) from the Projects tab.
• Enter the project name and choose Ok.
• Choose Single document. Hit Next.
• Use the defaults for Steps 2-5. Next, Next, Next, Next!
• On Step 6, choose CHtmlView for the Base class.
• Hit Finish, then Ok. You're done!

Let's write a browser!
I chose CHtmlView as our base class because it made our app a browser. That wasn't difficult, was it?

Build and run the application (hit Ctrl+F5), and you'll see Microsoft's C++ home page. Let's quickly change it to point to the page on your site where the news will appear - that way when we're finished I can instantly see the results.

• In the ClassView double-click on the OnInitialUpdate method in your View class.
• Change "http://www.microsoft.com/visualc/" to "http://CoverYourASP.com/"
• Check it out with Ctrl+F5.

Part 2: Put some meat in the application...

Featured sponsor
My favorite resources

CoverYourASP Mugs, T-shirts, caps - even Boxer shorts...
I don't make a penny from these, but they're a lot of fun! Don't you need a new mouse mat?


I share my content

Supporting ASPRSS

Do you need a quick and easy way to link to my articles? All the information you need is published with ASPRSS...