Server.Execute

  • Thread starter Thread starter Ben
  • Start date Start date
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
 
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
 
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.
 
Back
Top