With a few changes you can use the ASP.NET Source Code Viewer that is included with Microsoft's QuickStart Samples on your web site. You can use this viewer to list all of an application's files for viewing or to just view one file at a time. Start by copying srcview.aspx, SrcCtrl.ascx, srcctrlwin.aspx, and style.css to a directory in your web site. Edit the path information to match the new directory on lines 1, 10, 140, and 142 of srcview.aspx and lines 2 and 6 of srcctrlwin.aspx. Edit your Web.Config file (see View Source). Only files in the root directory, specified in Web.Config, can be viewed.
That's all the changes that are required. Now you can use the ASP.NET Source Code Viewer in two ways. The first way is to use a .src file that contains a list of files you want users to view. An example .src file is included with the source files for this article. Files to be viewed can be in the same directory as the .src file or in sub directories. The second way is used to display only one file. You first have to change listonly property on line 15 of srcview.aspx file to true. Hyperlink examples for both methods can be found with the source files for this article.
[ Run Sample ] | [ View Source ] | [ Download ]