use ASP .NET engine from C# application?

  • Thread starter Thread starter James
  • Start date Start date
J

James

Hello,

I'd like to use ASP as a template engine in my C# application. My
application sends out emails based on a template and some business
data. I have currently being using XSLT to do the templates by taking
business data in the form or XML and translating it into another XML
document which is parsed by my application to send the email, but
would like to have some more flexibility.

So, is it possible to have the ASP engine used as a generic template
engine? Where should I look for information on this?

Thanks,

-jr
 
James said:
I'd like to use ASP as a template engine in my C# application. My
application sends out emails based on a template and some business
data. I have currently being using XSLT to do the templates by taking
business data in the form or XML and translating it into another XML
document which is parsed by my application to send the email, but
would like to have some more flexibility.

So, is it possible to have the ASP engine used as a generic template
engine? Where should I look for information on this?


Take a look at this article in MSDN:
http://msdn.microsoft.com/msdnmag/issues/03/01/cuttingedge/default.aspx

It explains how to use the asp.net engine to create a personal web server
(code name "Cassini"), which may serve as inspiration to achieve your goal.
 
Take a look at this article in MSDN:http://msdn.microsoft.com/msdnmag/issues/03/01/cuttingedge/default.aspx

Thanks. I've looked at this and gotten it to work, but the more that I
play with it I'm not sure it'll work for my application. Basically I'd
like to be able to "pass in" a bunch of objects (or a DataSet) and
have the ASPX page do all the formatting and the output of the data
contained in that set and I don't see how this would possible. I
basically need to set variables which the ASPX page would need to
reference. Can't really see a way to do this. Seems like it would be
somehow possible to setup some session variables or something, but the
more I think about it seems like more and more like a kludge..


-jr
 
James said:
Thanks. I've looked at this and gotten it to work, but the more that I
play with it I'm not sure it'll work for my application. Basically I'd
like to be able to "pass in" a bunch of objects (or a DataSet) and
have the ASPX page do all the formatting and the output of the data
contained in that set and I don't see how this would possible. I
basically need to set variables which the ASPX page would need to
reference. Can't really see a way to do this. Seems like it would be
somehow possible to setup some session variables or something, but the
more I think about it seems like more and more like a kludge..

Once you've got the webserver working, you can request your webpage by
passing the parameters in the querystring
(mypage.aspx?param1=whatever&param2=somethingelse). But this will only work
for simple variables. If you need to pass a DataSet, you can save it as an
xml file and then have the aspx read that file. But then, as you say, it's
going to become a kludge.
 
Back
Top