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



Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
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


Samples

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

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