Solved

ASP as Javascript src

Posted on 2001-07-12
2
340 Views
Last Modified: 2006-11-17
Hi :-)

I have experimented with including asp files, as a javascript file.

Like

<script language="JavaScript" type="text/javascript" src="file.asp">
</script>

The the file.asp should generate the javascript.
It works for me, but people get error in Internet Explore 4.72. Is this only because of the stupid errors in Explore or is wrong to use anything else then .js extension as a javascript file ?

0
Comment
Question by:Netgurudk
2 Comments
 
LVL 7

Accepted Solution

by:
CJCraft earned 25 total points
Comment Utility
You could add the .js extension to the IIS Application Mappings and have asp.dll parse .js files, like it does .asp, before it sends the results to the client. This should take care of any issues with any browser. Since if I remember right, Netscape browsers only accept .js files for external JavaScript files.

Here's how to do it:
1. Open Internet Services Manager.
2. Right-click the Web server, and choose Properties from the context menu.
3. Master Properties
4. Select WWW Service | Edit | HomeDirectory | Configuration

From there you should see:

.asp C:\WINNT\System32\inetsrv\asp.dll GET,HEAD,POST,TRACE

ADD one for .js files that is:

.js C:\WINNT\System32\inetsrv\asp.dll GET,HEAD,POST,TRACE

If you are using the above technique to protect your client-side JavaScript from being read by users, then remember not only check the HTTP_REFERER header but also to disable caching on the browser so the user can't view the .js file from their Temporary Internet Files folder either.

I'd use the following:

<%
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>

Hope it helps,
CJCraft
0
 

Author Comment

by:Netgurudk
Comment Utility
Thank you very much ;)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now