ASP 101 - Active Server Pages 101 - Web04
The Place ASP Developers Go!

Windows Technology Windows Technology
15 Seconds
ASP 101
ASP Wire
VB Forums
VB Wire
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an site
ASP 101 is an site
Internet News
Small Business
Personal Technology

Corporate Info
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash

ASP.NET version of "Source Code"

This sample shows you how to read a text file off the file system and display the source code in a browser. In addition to illustrating the use of a StreamReader object, it also includes some basic error handling to handle things like people specifying the wrong filename.

One quick warning... as it stands, the script will show the source to any file in whatever folder you put it in. Make sure you don't mind sharing things like your web.config file or you'll need to modify the script to prevent it from displaying any sensitive files.

Here's a zip file of the code (1.1 KB).

Play with the running version.

View the live source code.

Back to the "Source Code" sample


Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback
The Network for Technology Professionals



Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers