Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: How do you execute VB code that resides in a Text File...

Reply
Thread Tools

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

 
 
CES
Guest
Posts: n/a
 
      10-01-2003
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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

so
> any advice or guidance would be appreciated.
>
>
>
> CES
>
>



 
Reply With Quote
 
 
 
 
Alvin Bruney
Guest
Posts: n/a
 
      10-02-2003
have a look at the system.process namespace
"CES" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > 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

> so
> > any advice or guidance would be appreciated.
> >
> >
> >
> > CES
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Discovering CSS refs in page custom control resides during design time. HTML ASP .Net Building Controls 1 01-28-2006 12:37 PM
How to get the module that a class resides in? jc Ruby 3 02-18-2005 07:43 PM
reference to a DTD that resides in a jar file avishosh XML 1 08-09-2004 02:42 PM
Get the UserControl on which a Control resides? Steve - DND ASP .Net 1 10-19-2003 05:48 AM
Referencing a control that resides on a customer web user control Jay Esguerra ASP .Net Web Controls 0 10-13-2003 05:12 PM



Advertisments