Server.Execute

B

Ben

Hiyo

I want to perform a programmatic server-side include, and I think that the
best way would be to use Server.Execute(path, optional textwriter).
Certainly ommitting the textwriter means that I can write to the output of
my page.

....however...

The content I wanted to append to the page is aspx code stored in a database
(surely this isn't the best way - suggestions welcome please!), and so I
figure it would be faster to write the code from the database into the aspx
output like this:

<html><body>test starts<br>

string dbaspx = Database.ReadSomeField();
// dbaspx == "<aspx:-- some aspx code --/>"
Server.Execute(dbaspx);

<br>test stops</body></html>


Kinda an odd scenario; your thoughts welcome :) Thanks in advance,
Ben
 
N

Natty Gur

Ben hi,

if you keep the data in DB its probebly static so maybe its betteer to
store the data in application cache.

Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
K

Kevin Spencer

It's a method of the HttpServerUtility class. Similar to Server.Transfer,
except that after executing the target page, control returns to the calling
page. It was more in vogue with classic ASP, since classic ASP is
procedural. You could use it to do a "dynamic include" - include content
from another ASP page conditionally. ASP.Net has better mechanisms for such
things, so it isn't used very often.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
The more I learn, the less I know.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top