469,290 Members | 1,887 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,290 developers. It's quick & easy.

ASP editing .js file

I have a .js menu file that runs in all of my intranet
files. I have an asp calendar system where I can add
calendar names to a db and it will display these new
calendars. What I don't have is a good way to edit my .js
menu file to add a new menu item.

Can fso add a line to a .js file that is "live" on an
intranet or will it run into file locks? by iis??

I am writing the code to try it now but I thought I would
ask.

Thanks
Mike
Jul 19 '05 #1
7 3873
it should be able to. IIS reads it in then closes it. You should be able to
open it, write to it, close it fairly quickly.
Just be careful though. Many browsers will cache the .JS file I believe so
even after a change you may not see the changes on the clients/browsers
right away.
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Mike D" <an*******@discussions.microsoft.com> wrote in message
news:0e****************************@phx.gbl...
I have a .js menu file that runs in all of my intranet
files. I have an asp calendar system where I can add
calendar names to a db and it will display these new
calendars. What I don't have is a good way to edit my .js
menu file to add a new menu item.

Can fso add a line to a .js file that is "live" on an
intranet or will it run into file locks? by iis??

I am writing the code to try it now but I thought I would
ask.

Thanks
Mike

Jul 19 '05 #2
Curt_C [MVP] wrote on 05 aug 2004 in
microsoft.public.inetserver.asp.general:
Just be careful though. Many browsers will cache the .JS file I
believe so even after a change you may not see the changes on the
clients/browsers right away.


If you have trouble with the .js caching, why not just insert the file ASP-
wize:

<script style="text/javascript">
<!--#include virtual ="/lib/myJs.js"-->
</script>

You can even specigy the expiry in the js file by specifying it as
<% Response.Expires = 1 %> so:

<script style="text/javascript">
<!--#include virtual ="/lib/myJs.asp"-->
</script>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #3
Thanks for the reply I have not used virtual includes
before. I there an advantage to putting all of my
includes in a virtual folder? Or do you maintain your
includes in the web?

Mike

-----Original Message-----
Curt_C [MVP] wrote on 05 aug 2004 in
microsoft.public.inetserver.asp.general:
Just be careful though. Many browsers will cache the .JS file I believe so even after a change you may not see the changes on the clients/browsers right away.
If you have trouble with the .js caching, why not just

insert the file ASP-wize:

<script style="text/javascript">
<!--#include virtual ="/lib/myJs.js"-->
</script>

You can even specigy the expiry in the js file by specifying it as<% Response.Expires = 1 %> so:

<script style="text/javascript">
<!--#include virtual ="/lib/myJs.asp"-->
</script>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
.

Jul 19 '05 #4
Mike D wrote on 06 aug 2004 in microsoft.public.inetserver.asp.general:
Thanks for the reply I have not used virtual includes
before. I there an advantage to putting all of my
includes in a virtual folder? Or do you maintain your
includes in the web?


Are these contradictory?
<script style="text/javascript">
<!--#include virtual ="/lib/myJs.asp"-->
</script>


This is not a virtual folder,
just a virtual specification of a very real folder,
"relative" to the web root. A virtual path!

The advantage over a relative include is, that you can change the
"includer's" path/location while path to the included file remains valid.

[please do not toppost when replying on usenet]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #5
-----Original Message-----
Mike D wrote on 06 aug 2004 in microsoft.public.inetserver.asp.general:
Thanks for the reply I have not used virtual includes
before. I there an advantage to putting all of my
includes in a virtual folder? Or do you maintain your
includes in the web?


Are these contradictory?
<script style="text/javascript">
<!--#include virtual ="/lib/myJs.asp"-->
</script>


This is not a virtual folder,
just a virtual specification of a very real folder,
"relative" to the web root. A virtual path!

The advantage over a relative include is, that you can

change the"includer's" path/location while path to the included file remains valid.
[please do not toppost when replying on usenet]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
.


If I have a path Myweb/Includes I can add an include file
using

<script type="text/javascript" language="JavaScript"
src="Includes/MenuLib.js"></script>

but I can't use the virtual syntax (these are copied from
different levels)

<!--#include virtual ="/../../Includes/MenuLib.js"-->

If I add a new Virtual Directory and point it to the
includes pathe it still can't find the file but if I make
a new folder outside of the web structure and point to
that with a virtual directory the page can be found.??

Make sense?

Mike
Jul 19 '05 #6
Mike D wrote on 06 aug 2004 in microsoft.public.inetserver.asp.general:
<!--#include virtual ="/../../Includes/MenuLib.js"-->

If I add a new Virtual Directory and point it to the
includes pathe it still can't find the file but if I make
a new folder outside of the web structure and point to
that with a virtual directory the page can be found.??


No. Include virtual must be a descendant of the root, so in the web
structure, I think.

Perhaps this will do:

<% Server.execute Server.mappath("/../../lib/myJs.asp") %>

[The whole idea was to have a .asp file
so that you can head that with a <% Response.Expires = 0 %> ?]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #7
Mike D wrote on 06 aug 2004 in microsoft.public.inetserver.asp.general:
<!--#include virtual ="/../../Includes/MenuLib.js"-->

If I add a new Virtual Directory and point it to the
includes pathe it still can't find the file but if I make
a new folder outside of the web structure and point to
that with a virtual directory the page can be found.??


No. Include virtual must be a descendant of the root, so in the web
structure, I think.

Perhaps this will do:

<% Server.execute Server.mappath("/../../lib/myJs.asp") %>

[The whole idea was to have a .asp file
so that you can head that with a <% Response.Expires = 0 %> ?]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by joethis | last post: by
4 posts views Thread by Jerry Khoo | last post: by
7 posts views Thread by A_StClaire_ | last post: by
5 posts views Thread by VB Programmer | last post: by
reply views Thread by Roshan | last post: by
12 posts views Thread by Thomas Bartkus | last post: by
8 posts views Thread by D | last post: by
1 post views Thread by crazyGal | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.