Solved

include vbscript file

Posted on 2012-04-10
6
357 Views
Last Modified: 2012-04-10
I have a script I want to have on a separate page and simply link to the pages that need the script. I created a file called 'ipadcode.asp'  the code on that page is:

---

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Function isIPad()
    If InStr(Request.ServerVariables("HTTP_USER_AGENT"), "iPad") > 0 Then
        isIPad = True
    Else
        isIPad = False
    End If
End Function
%>


---

1. Is the code above correct or should it be different ?  
2. Is the name of the file correct or should I change the extension to . vb ?

---

the page links to this file using :

<script language="VBScript" runat="server" src="../../../ScriptLibrary/ipadcode.asp"></script>

Is this correct or should the syntax be different ?

Hope it makes sense.
0
Comment
Question by:amucinobluedot
  • 3
  • 3
6 Comments
 
LVL 28

Accepted Solution

by:
sammySeltzer earned 500 total points
ID: 37830779
Have the vbscript as include file like this:

<%Function isIPad()
    If InStr(Request.ServerVariables("HTTP_USER_AGENT"), "iPad") > 0 Then
        isIPad = True
    Else
        isIPad = False
    End If
End Function
%>

and save it as ipadcode.inc

THen include it like this:

<!-- #include virtual="/FolderName/ScriptLibrary/ipadcode.inc" -->
0
 

Author Comment

by:amucinobluedot
ID: 37830784
I tried the above, made sure the link is correct (As you can see in the screenshot), and go this error:

Active Server Pages error 'ASP 0126'
Include file not found

/bluedot/Intranet/Cases/Documents/UpdateMergedLetter.asp, line 4

The include file '/../../../ScriptLibrary/ipadcode.inc' was not found.
screenshot.gif
0
 

Author Comment

by:amucinobluedot
ID: 37830796
I even tried copying the file to the same folder and got:

Active Server Pages error 'ASP 0126'

Include file not found

/bluedot/Intranet/Cases/Documents/UpdateMergedLetter.asp, line 4

The include file 'ipadcode.inc' was not found.

---

with this code:

<!-- #include virtual="ipadcode.inc" -->

any clues ?
0
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.

 
LVL 28

Expert Comment

by:sammySeltzer
ID: 37830805
No,

If you are going to put the file in the folder where all your files are, then this:

<!-- #include file="ipadcode.inc" -->

When you use Virtual, you are basically saying that the include file is in a different folder from where the rest of your files are.
0
 

Author Comment

by:amucinobluedot
ID: 37830813
Actually i moved it back to the folder where i want it and used:

<!-- #include file="../../../ScriptLibrary/ipadcode.inc" -->

and worked fine .. thanks !
0
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 37830829
Some servers may not accept that method because of the configuration.

In the event that you run into that situation, simply go to iis, expand default website, right-click on your website, click properties, click options, then check the "Enable Parent Paths" box.

Meanwhile, please accept the answer since it solved your problem and close the thread.
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

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…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

912 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

17 Experts available now in Live!

Get 1:1 Help Now