473,569 Members | 2,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you execute VB code that resides in a Text File...

CES
All,

I'm trying to figure out how I would execute code that would be shared over
a number of wwwroot folders.

Basically it would be the equivalent of an .inc file only instead of
residing below the wwwroot it would exist above (FYI - I want to do this so
when information changes on a page like my "Terms of Use" it will be
reflected throughout each site I maintain) as apposed to changing the file
for each domain.

I've tried using StreamReader but have run into a problem. the page loads
(with the .txt file Embedded in the page without any problem) but the VB
code in the file is not executed:

'This is the code that calls the appropriate file.

accountRoot = "\\server\root_ Folder\"

Dim footer_file As New IO.FileStream(a ccountRoot & "_includes\file .txt",
IO.FileMode.Ope n, IO.FileAccess.R ead)

Dim myReader As New IO.StreamReader (footer_file)

Dim footer_txt As String

footer_txt = myReader.ReadTo End()

response.write( footer_txt) ' I've tried server.execute( footer_txt) but I'm
getting error messages even when the page is empty.

-XXXXXXXXXXXXXX-

'This is what is returned to the browser (note - That the <%
=DatePart("yyyy ", Now) %> is returned but is invisible on the page.

..

<p class="footer_h eader">

Copyright <% =DatePart("yyyy ", Now) %> - XYZ, Inc. - All rights reserved.

<br />

..

I've just switched from VBS to VB so I'm sure this is the wrong approach so
any advice or guidance would be appreciated.

CES
Nov 17 '05 #1
3 1769
Well, remember that ASP.NET pages are compiled pages and not scripts.

The best thing that I can think of you doing is to create a class with the
code that you want to share. Sign it with a strong name and place it into
the GAC. Any .NET assembly can access the code then.

"CES" <NO**@NOEMAIL.c om> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
All,

I'm trying to figure out how I would execute code that would be shared over a number of wwwroot folders.

Basically it would be the equivalent of an .inc file only instead of
residing below the wwwroot it would exist above (FYI - I want to do this so when information changes on a page like my "Terms of Use" it will be
reflected throughout each site I maintain) as apposed to changing the file
for each domain.

I've tried using StreamReader but have run into a problem. the page loads
(with the .txt file Embedded in the page without any problem) but the VB
code in the file is not executed:

'This is the code that calls the appropriate file.

accountRoot = "\\server\root_ Folder\"

Dim footer_file As New IO.FileStream(a ccountRoot & "_includes\file .txt",
IO.FileMode.Ope n, IO.FileAccess.R ead)

Dim myReader As New IO.StreamReader (footer_file)

Dim footer_txt As String

footer_txt = myReader.ReadTo End()

response.write( footer_txt) ' I've tried server.execute( footer_txt) but I'm
getting error messages even when the page is empty.

-XXXXXXXXXXXXXX-

'This is what is returned to the browser (note - That the <%
=DatePart("yyyy ", Now) %> is returned but is invisible on the page.

.

<p class="footer_h eader">

Copyright <% =DatePart("yyyy ", Now) %> - XYZ, Inc. - All rights reserved.
<br />

.

I've just switched from VBS to VB so I'm sure this is the wrong approach so any advice or guidance would be appreciated.

CES

Nov 17 '05 #2
CES
What I'm really looking for is the vb.net equivalent to eval() that is in
VBScript... but alas it's not their.
CES

"CES" <NO**@NOEMAIL.c om> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
All,

I'm trying to figure out how I would execute code that would be shared over a number of wwwroot folders.

Basically it would be the equivalent of an .inc file only instead of
residing below the wwwroot it would exist above (FYI - I want to do this so when information changes on a page like my "Terms of Use" it will be
reflected throughout each site I maintain) as apposed to changing the file
for each domain.

I've tried using StreamReader but have run into a problem. the page loads
(with the .txt file Embedded in the page without any problem) but the VB
code in the file is not executed:

'This is the code that calls the appropriate file.

accountRoot = "\\server\root_ Folder\"

Dim footer_file As New IO.FileStream(a ccountRoot & "_includes\file .txt",
IO.FileMode.Ope n, IO.FileAccess.R ead)

Dim myReader As New IO.StreamReader (footer_file)

Dim footer_txt As String

footer_txt = myReader.ReadTo End()

response.write( footer_txt) ' I've tried server.execute( footer_txt) but I'm
getting error messages even when the page is empty.

-XXXXXXXXXXXXXX-

'This is what is returned to the browser (note - That the <%
=DatePart("yyyy ", Now) %> is returned but is invisible on the page.

.

<p class="footer_h eader">

Copyright <% =DatePart("yyyy ", Now) %> - XYZ, Inc. - All rights reserved.
<br />

.

I've just switched from VBS to VB so I'm sure this is the wrong approach so any advice or guidance would be appreciated.

CES

Nov 17 '05 #3
have a look at the system.process namespace
"CES" <NO**@NOEMAIL.c om> wrote in message
news:ec******** ******@TK2MSFTN GP11.phx.gbl...
What I'm really looking for is the vb.net equivalent to eval() that is in
VBScript... but alas it's not their.
CES

"CES" <NO**@NOEMAIL.c om> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
All,

I'm trying to figure out how I would execute code that would be shared

over
a number of wwwroot folders.

Basically it would be the equivalent of an .inc file only instead of
residing below the wwwroot it would exist above (FYI - I want to do this

so
when information changes on a page like my "Terms of Use" it will be
reflected throughout each site I maintain) as apposed to changing the file for each domain.

I've tried using StreamReader but have run into a problem. the page loads (with the .txt file Embedded in the page without any problem) but the VB
code in the file is not executed:

'This is the code that calls the appropriate file.

accountRoot = "\\server\root_ Folder\"

Dim footer_file As New IO.FileStream(a ccountRoot & "_includes\file .txt",
IO.FileMode.Ope n, IO.FileAccess.R ead)

Dim myReader As New IO.StreamReader (footer_file)

Dim footer_txt As String

footer_txt = myReader.ReadTo End()

response.write( footer_txt) ' I've tried server.execute( footer_txt) but I'm getting error messages even when the page is empty.

-XXXXXXXXXXXXXX-

'This is what is returned to the browser (note - That the <%
=DatePart("yyyy ", Now) %> is returned but is invisible on the page.

.

<p class="footer_h eader">

Copyright <% =DatePart("yyyy ", Now) %> - XYZ, Inc. - All rights

reserved.

<br />

.

I've just switched from VBS to VB so I'm sure this is the wrong approach

so
any advice or guidance would be appreciated.

CES


Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4264
by: CES | last post by:
All, I'm trying to figure out how I would execute code that would be shared over a number of wwwroot folders. Basically it would be the equivalent of an .inc file only instead of residing below the wwwroot it would exist above (FYI - I want to do this so when information changes on a page like my "Terms of Use" it will be reflected...
0
2033
by: Eric Wood | last post by:
We have an application that is accessed using shared drives, client executes program from server. We have already coded the program to create and save the a bat file either locally on the users machine or on the server. Our problem is that when we execute the bat file from the vb code it does not work properly. The bat file is used to connect...
3
414
by: CES | last post by:
All, I'm trying to figure out how I would execute code that would be shared over a number of wwwroot folders. Basically it would be the equivalent of an .inc file only instead of
4
7862
by: Chris | last post by:
I posted this in the C# language group, then thought it might be more appropriate in this group. I would not cross-post except I want the answer so badly. I built small C# Web and Web Service applications in a training class last week. The applications worked in the class, but when I tried to run them again over the weekend, they both...
5
1582
by: VB Programmer | last post by:
Here's the quick situation: 1. Using VS.NET I create 1 fully functioning aspx page, with code behind. (Simple webform: It has a few text boxes, 1 hyperlink, 2 and buttons.) 2. I uploaded it to my website and it works PERFECTLY. 3. My friend has a webserver and wants me to stick the aspx page into his web server. He says it has IIS and...
1
14624
by: Eric Wood | last post by:
We have an application that is accessed using shared drives, client executes program from server. We have already coded the program to create and save the a bat file either locally on the users machine or on the server. Our problem is that when we execute the bat file from the vb code it does not work properly. The bat file is used to connect...
0
2085
by: oliver | last post by:
QUESTION: How to access an object embedded in a UserControl through Javascript file? Another way to ask this question: How to execute script from a UserControl, accessing other objects in that UserControl? (Script attached to, and executed by, a UserControl embedded server control can ‘see’ the UserControl through the root document...
0
1233
by: nano2k | last post by:
Hi I develop a client/server application using webservices. So, I have a client app and a webservice that responds to client app requests - nothin' new. In certain circumstances (namely, when importing data) I want some compiled code located in client app to be *transferred* to the webservice, optionally to make some bindings to the server...
9
1285
by: Pachydermitis | last post by:
Hi, Is there any way to execute a function by using it's pointer? The reason I want to do this is: I have a control on a form that I have wrapped with a class. I want to be able to dynamically assign a function that is in the form's code to an event defined in the wrapper class. The application.run function won't recognise the name of the...
0
7615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
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...
1
7677
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
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...
1
2115
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
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
940
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...

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.