[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

include vbscript file

Posted on 2012-04-10
6
Medium Priority
?
408 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:Aleks
  • 3
  • 3
6 Comments
 
LVL 29

Accepted Solution

by:
sammySeltzer earned 2000 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:Aleks
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:Aleks
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

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:Aleks
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 29

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

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

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month19 days, 17 hours left to enroll

873 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