ASP.Net page not including Javascript file.

J

Joseph Ferris

Hello everyone.

I recently reloaded my system, and I am now having problems getting one
of my client's sites running. I pulled a copy of the development tree
for the project out of subVersion (the source control software we are
using) and placed it into the IIS Web Root. After building and
attempting to run the Solution, I am having problems with included
Javascript files.

How it is set up is that we have some .js files that have common
functions that are reused by the pages. So, we include the .js file in
each page, and the page calls the function(s) on an as-needed basis.
This has previously worked on my machine, and works on the other
developers' machines. When I run it, I get a "Microsoft JScript
runtime error: Object Expected.". I have tried shutting down the
Solution and clearing the VSWebCache, thinking it might be a fragment
from the previous client site that I was using (such as it was looking
for a file that didn't exist in the users site, and it is looking at a
cache somewhere). But, to no avail... I am still stuck.

Here is a fragment of the aspx page in question:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Client Login</title>
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<link href="styles/default.css" type="text/css" rel="stylesheet">
<!-- javascript code -->
<script language="javascript" src="Scripts/uiEffects.js"></script>
<script language="javascript" type="text/javascript">

function loadPage(){
preLoadImages();
document.getElementById("txtUserId").focus();
}

</script>
</HEAD>

In this case, the uiEffects.js file does not get loaded, or if it does,
the preLoadImages() function in the loapPageFunction() is not being
found, as this is where the message is firing. If I look at the
Running Processes, I can see that uiEffects.js is not listed, as it
usually would be if it was loaded. There are no other error messages
until I hit the call for a function that is within the included file.

Any help would be greatly appreciated, as I am dead in the water until
I can get this resolved.

Thank you in advance,

Joseph
(e-mail address removed)
 
K

Ken Cox [Microsoft MVP]

Hi Joseph,

Is it possible that the Scripts directory was previously created as a
virtual directory in IIS and needs to be set that way again?

What happens if you put the full URL such as

src="http://myserver/Scripts/uiEffects.js">

Just trying a couple of ideas to get you going again...

Ken
Microsoft MVP [ASP.NET]
Toronto
 
J

Joseph Ferris

Ken,

That was precisely what was going on. I removed the existing Scripts
Virtual Directory and recreated it. Worked perfectly.

Thank you, kindly,

Joseph
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top