473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How do you execute VB.net 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(accountRoot & "_includes\file.txt",
IO.FileMode.Open, IO.FileAccess.Read)

Dim myReader As New IO.StreamReader(footer_file)

Dim footer_txt As String

footer_txt = myReader.ReadToEnd()

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_header">

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
soany advice or guidance would be appreciated.
CES
Jul 17 '05 #1
1 4248
Almost everybody here is using VB6 or lower. While you may get a stray
answer to VB.NET questions here, you should ask them in newsgroups devoted
exclusively to .NET programming. Look for newsgroups with the word "dotnet"
in their name.

For the news.devx.com news server, try these

vb.dotnet.discussion
vb.dotnet.technical

For the microsoft news server, try these newsgroups...

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb

There are some others, but these should get you started.

Rick - MVP


"CES" <No**@noSpam.com> wrote in message
news:m4********************@speakeasy.net...
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(accountRoot & "_includes\file.txt",
IO.FileMode.Open, IO.FileAccess.Read)

Dim myReader As New IO.StreamReader(footer_file)

Dim footer_txt As String

footer_txt = myReader.ReadToEnd()

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_header">

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
soany advice or guidance would be appreciated.
CES

Jul 17 '05 #2

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

Similar topics

0
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...
3
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
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...
5
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...
1
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...
0
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...
0
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...
2
by: Sike | last post by:
Hi everyone, I've been browsing this and a few other related newsgroups trying to get my head around this problem, and so far all the trails seem to go cold, without an acceptable solution being...
9
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.