Solved

include vbscript file

Posted on 2012-04-10
6
362 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
RegEx Help - open to other simple suggestions 8 52
is this a cms? 8 60
Passing Credentials into a command line 13 33
Index on a Table 6 11
I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files 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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

776 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