Solved

ASP as Javascript src

Posted on 2001-07-12
2
347 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# Gridview does not exist in the current context 14 63
Update Stored Procedure question 8 48
replace quotes with UTF-8 character 38 82
Summernote and form validation 10 92
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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

937 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

10 Experts available now in Live!

Get 1:1 Help Now