Click here to Skip to main content
Click here to Skip to main content

See latest additions to CodeProject from VS.NET Start Page

By , 18 Jan 2004
 

Click image to enlarge

Introduction

This article allows you to see the latest addition to the Code Project directly in your "Online Resources" on the Start Page of VS.NET

Background

See MSDN article Customizing the Visual Studio Start Page

Using the code

First step : Create a Virtual Directory in IIS (named CodeProjectDownload) . Then paste the content of the CodeProjectDownload.zip into this folder.

Test : Point your browser to the http://localhost/CodeProjectDownload/WebForm1.aspx : what you will see is a XML document

If not, please check your Internet connection and/or Code Security for Asp.Net

Second step : Locate your Visual Studio .NET installation folder and locate the \Common7\IDE\HTML\1033 folder ( usually : E:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\HTML\1033 - for other languages than English, please replace 1033 with your language code)

If not created, please create a folder named Custom - and put the contents of CodeProject.zip in this folder.

Now, run Microsoft Visual Studio .NET 2003 - go to Start Page , click on Online Resources. You will see a "Last Code Project added resources" item. Click on this item. And you will see the latest code addition for Code Project. ( see the image).

The important code is the one that downloads the XML and the one that interprets the XML

Uri u=new Uri(@"http://www.codeproject.com/webservices/articlerss.aspx"); 
HttpWebRequest hwr=(HttpWebRequest)HttpWebRequest.CreateDefault(u);
HttpWebResponse hwre=(HttpWebResponse)hwr.GetResponse();
Stream s= hwre.GetResponseStream();
Byte[] read = new Byte[512];
int bytes = s.Read(read, 0, 512);
StringBuilder sb=new StringBuilder();
while(bytes>0){
Encoding encode =Encoding.GetEncoding("utf-8");
sb.Append(encode.GetString(read,0,bytes));
bytes = s.Read(read, 0, 512); 
} 

XmlDataDocument xd=new XmlDataDocument();
xd.LoadXml(sb.ToString());
XmlNodeList xnl=xd.DocumentElement.GetElementsByTagName("item");
ItemCodeProjectCollection icpcol=new ItemCodeProjectCollection();
foreach(XmlNode xn in xnl){
ItemCodeProject icp=new ItemCodeProject();
icp.Title= xn.SelectSingleNode("title").InnerText;
icp.Description=xn.SelectSingleNode("description").InnerText;
icp.Url=xn.SelectSingleNode("link").InnerText;
icpcol.Add(icp.Url,icp);
}

The rest is in the method LinksStartPage that constructs the XML needed by the Start Page.

Points of Interest

The project can be the start to interpret others RSS feeds, like the ones on DevX

Also, the project can be simpler if the Code Project owners ( with a XSL) transform theirs XML to the specific XML that is recognized by Start Page.

History

  • 2004-01 - first draft.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

ignatandrei
Web Developer
Romania Romania
Member
VB6(from VB3) addictive (MCP also) + ASP
Now trying C#
Database : SQL Server,DB2

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionC# needed? Will it work with Vis C++ .NET std?memberhgohel20 Jan '04 - 4:03 
I have Visual C++ .NET standard and I could not get the page to display properly in VS.NET - I just get a message "Unable to load content from the server."
 
Should I have C# (which I don't) on my machine? WebForm1.aspx seems to refer to it. IIS seems to be working OK.
GeneralRe: C# needed? Will it work with Vis C++ .NET std? Pinmemberhgohel20 Jan '04 - 5:39 
1. I have downloaded both ZIP files today (Jan 20), so I have the latest version. Yes, the referernce to WebForm1.aspx is pointing to localhost; when I open this URL in a browser, it starts VS IDE and loads that file.
 
2. The only line in WebForm1.aspx is this:
 
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="CodeProjectDownload.WebForm1" %>
 
I changed C# to C++ and there was no difference - When I go to online resources, I still get the message "Unable to load content from the server."
 
Can you please check the ZIP files avalable for download are OK? Thanks.

GeneralRe: C# needed? Will it work with Vis C++ .NET std? Pinmemberignatandrei20 Jan '04 - 20:00 
Yes - the files are OK.
What is the result ,if you open Internet Explorer and type :
http://localhost/CodeProjectDownload/WebForm1.aspx
 
Waiting for the result
Andrei

GeneralRe: C# needed? Will it work with Vis C++ .NET std? Pinmemberhgohel21 Jan '04 - 2:45 
As I said in my previous message, when I go to that URL, it will start the Visual Studio .NET IDE and open the file for editing. Is that correct?
GeneralRe: C# needed? Will it work with Vis C++ .NET std? Pinmemberignatandrei21 Jan '04 - 2:48 
Apparently, this means that you have not installed IIS on your PC.
The http://localhost works ?
GeneralRe: C# needed? Will it work with Vis C++ .NET std? Pinmemberhgohel21 Jan '04 - 3:03 
IIS is installed & running. I created the virtual directory per your instructions through the Administrative Services > IIS.
 
Yes, http://localhost works and Windows tells me that "Your Web service is now running." Annoyingly it resizes my browser to a smaller size, but that's a different issue.
 
However, the Virtual Directory I created for CodeProjectDownload is not under the default root - I put it on another drive, could that be a problem?
 
Thanks for your help.
GeneralRe: C# needed? Will it work with Vis C++ .NET std? Pinmemberignatandrei21 Jan '04 - 3:13 
Then , maybe the .aspx files are not registered with IIS.
Goto Internet Service Manager
Point to CodeProjectDownload website
Right Click = > properties => configuration
 
On the App Mappings tab - I think that you will find the .asp( and more other extensions ),but not the .aspx file...
 
If so , please use aspnet_regiis.exe ( you will find in your .Net directory ) or reinstall .NET
 
Tell me if am I right
GeneralRe: C# needed? Will it work with Vis C++ .NET std? Pinmemberhgohel21 Jan '04 - 4:57 
Yes, you are correct, .aspx was missing from the configuration. I tried to add it quickly but it seems I need to configure some more things. It won't be possible to go through that immediately though but I will revert when I can.
 
Thanks for finding the problem though.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 19 Jan 2004
Article Copyright 2004 by ignatandrei
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid