473,698 Members | 2,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to include file using vbscript

Soniad
66 New Member
Hello,

I want to include asp file within vbscript, this file name i am taking in variable .
and when i use this variable in the include tag outside delimiters(<%%> ), it does not work,
Expand|Select|Wrap|Line Numbers
  1. <%Dim AllocPath
  2. AllocPath = "SchemeAllocation/"&Trim(lcase(ProductName))&"/QuotaAlloc.asp"
  3.                 %>
  4.  
  5. <!-- #include file=<%=AllocPath %>--> 
  6.  
  7.  
if i give the file name directly, then it works .
Expand|Select|Wrap|Line Numbers
  1. <!-- #include file="SchemeAllocation/mobilephones/QuotaAlloc.asp"--> 
  2.  
how to include this page using vbscript or without,such that the code inside this page should execute.

also , it shud take care that , some of the variables which are used in the parent page (including page) are accessed/used directly in child (included page).


Regards,
"D"
Feb 16 '09 #1
5 7510
sashi
1,754 Recognized Expert Top Contributor
I don't see any major differences in the 1st code segment & the 2nd code segment. Why do you need to assign the path details to a string type variable (AllocPath) when you can assign the path details straight the "#include" directive?

What are the scope of the variables? If you need to reuse a variable then you should make it public and not private.

Avoid using to many variables as it's will create load at server side.
Feb 16 '09 #2
Soniad
66 New Member
@sashi
The productName varies. and i have created different folders for different products.as it is necessary, coz,if any new product is added then no need to change in the code by hardcoding path to access files under different products, thats y i am taking the path in variable.

Regards,
"D"
Feb 17 '09 #3
sashi
1,754 Recognized Expert Top Contributor
Look at more dynamic approach, why not store the product details. i.e. name, code & supplier in the database.

Using MS Access as a starter would be a better choice. Good luck.
Feb 17 '09 #4
jhardman
3,406 Recognized Expert Specialist
Sashi is right, but I'm not sure his explanation is clear. There is a problem using a vbscript variable in an include file declaration because the include is fired BEFORE the vbscript is read. The major reason for doing it this way is so you can put common subroutines and functions in an include file, include it at the top of the page, and call those functions as you go. Does this make sense?

Of course if you want to include straight HTML or CSS code into your ASP page, there is no reason to use a Server-side include. The only time I would prefer to use an include is to add common subroutines. I believe you will need to rethink how you are going to work your page, feel free to ask for more pointers if needed.

Jared
Feb 17 '09 #5
Soniad
66 New Member
Hello,


I used another way, as variables not working or used in include tag ,
and i am calling pages according to the productnames, also i needed to execute the code in the calling page in the background.
I used ajax . in this i can call and execute pages depending on the productname.


Regards,
"D"
Feb 25 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1834
by: david | last post by:
Hi I'm trying to include file using <!-- #include file="abc.asp"--> and it works without any problem. but the problem is in if file name is in asp variable how should i write??? Thanx in advance... david
3
1584
by: TNG | last post by:
Hi, I try to accomplish something like this: <!--#include file="menu_<%response.write (strproduct)%>.html"--> But unfortunally, I quess there is something with my syntax... any idea ?
9
2995
by: Sarath | last post by:
I am working with an application using ASP, getting below error when i am trying to include new asp include file. _____________________________________________________________________ Microsoft VBScript runtime error '800a0006' Overflow: '' ____________________________________________________________________ I am sure that there is no error in the new asp file as if i delete any existing include file then no issues.
2
8708
by: Scott | last post by:
Is there a way to check if a file exist using VBScript in an ASP page. So the code might go something like this: If Exists("C:\Junk\1.txt") then Do something Else Do something else End If Thx,
1
1487
by: sastry1234 | last post by:
Hi There, How can I create an xml file or edit an xml file using VBScript? I need a code help. Could any one help me plz? -SAS
0
1816
by: uspramod | last post by:
hi the source is an excel file it is pivoted, i want to do unpivoting using vbscript regards Pramod
5
3823
by: Rohit111111 | last post by:
Hello All, I new to ASP and i am using VBScript, I want to delete a file which is located on the remote machine hbow can i delete that file.plz help its urgent
8
22688
by: meiliong | last post by:
I would like to read a column of data in csv file on each rows and get the data to perform calculation as shown below: "Sample Number","POD1","POD5","Time" 803,E7,03, 1803,E7,03,3.3330 us 2803,E7,03,3.3330 us 3803,E7,03,3.3330 us 4803,E7,03,3.3345 us 5803,E7,03,3.3330 us 6803,E7,03,3.3330 us
3
5796
by: mfaisalwarraich | last post by:
hi everybody, im trying to include a html file inside another html file. please tell me how i can do this. im trying with this tag but its not working for me please tell me what im doing wrong here. <!--#include file="includes/sidebar.html" --> an early reply is requested please.
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8876
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7741
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.