README.md

December 5, 2022 ยท View on GitHub

Protect Your Code

Description

Simple way of preventing access to your client side javascripts and even style sheets

More Info

Submitted On
Bydselkirk
LevelIntermediate
User Rating4.7 (14 globes from 3 users)
CompatibilityASP (Active Server Pages)
CategorySecurity
WorldASP / VbScript
Archive File

Source Code

I know that very single web developer has either wanted or has been asked if they can protect there client side scripts. Now there's an answer, it quite simply prevents an individual from downloading a HTML pages external scripts files.

How it works
Every good developer knows to rename all there script files to the asp extension to protect their asp code. This unforunitely does not protect your client side scripts. The way around it is since we already have our files renamed to asp extensions, why not take advantage of it. All we need to do is implement the response.end statement before the actualy script and nothing will be viewed. The tricky part is to detect whether or not you to allow the page to render. We can do this by performing some simple request.servervariable checks. I create an include file called "validate_view.asp". I simply include the file at the top of each script file. I then call the procedure "validate_view" which is contained in the include file. This will perform the check. I also pass the content type with the procedure to make the page react as it should normally. The procedure then performs some basic checks of where you came from, what domain is being used and a couple others. You can even pass a querystring called page_pass which allows you to view the page from anywhere. You can even customize various parts of the code for your own personal needs.

Download example
[here]

I appreciate any comments or suggestions you may have.