Solved

include vbscript file

Posted on 2012-04-10
6
376 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: 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 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 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