Solved

include vbscript file

Posted on 2012-04-10
6
349 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Vbscript 8 67
Choose the older file FSO 6 31
asp syntax 3 24
OID and Active Directory Attributes 9 37
Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

757 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

20 Experts available now in Live!

Get 1:1 Help Now