Solved

ASP as Javascript src

Posted on 2001-07-12
2
357 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
ID: 6276622
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
ID: 6276695
Thank you very much ;)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

830 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