65.9K
CodeProject is changing. Read more.
Home

Get HTML Source of any URL

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.22/5 (9 votes)

Mar 28, 2001

viewsIcon

330883

downloadIcon

4309

This articles shows how to get HTML source of a URL, even if the URL uses tricks to prevent you from viewing the source

Introduction

Some web sites don't let you view the source code by disabling the right mouse key. Some other web sites don't display top level menus, so you can not view source using "View + Source" menu option.

How to display the code

So, how do you display the code, if a site uses one of the above method to prevent you from seeing the source code. The sample ASP application uses Microsoft XMLHttp object to get a URL's source code. It just makes a synchronous HTTP Get request and displays the response in a textarea.

Installation Notes

Copy the ASP file to the root directory (typically, inetpub/wwwroot). You must run either a Personal Web Server on your machine or have access to a web server that runs IIS.