Dynamically generate HTML in C#

  • Thread starter Thread starter Rathtap
  • Start date Start date
R

Rathtap

I want to write a C# application (lets call it Generator) that will
receive an argument(patient account number) and dynamically generate a
series of linked HTML files (claim information, payments, denials etc)
by querying a database based on the argument. This Generator can be
called from an aspx web page, a Cold Fusion page as well as from a
windows application.
1. Does this C# app have to be a console application to receive
arguments?
2. Is there an easy way to create the HTML file without having to
learn all the HTML syntax?
3. I think it would have been easy enough if it were all within the
ASP.net project itself but because this app needs to be called by a
number of different applications(which are not even .Net apps) I
assume I need a stand-alone generator. Moreover one calling
application is an off-the-shelf third-party product which prevents me
from modifying their code to include the Generator.
This third-party app is however capable of shelling.
4. I assume the calling application should also provide the file name
to be assigned to this generated HTML file because the Generator will
have no way of relaying that information back.
5. Anything else I should be thinking of??
Thanks.
 
Rathtap,

Given the requirements, I don't see how it can NOT be an ASP.NET
application. Basically, you would serve up the HTML as needed. The
parameters would come in the form of querystring parameters.

Then, to get the HTML, you would create a component which would make a
request using the HttpWebRequest and HttpWebResponse classes (accessing your
ASP.NET page), download the HTML and then save it or do whatever you want
with it. The component is what you would be distributing, not the ASP.NET
app. It will always connect to your ASP.NET app.

Hope this helps.
 
Hi,

You don;t have to create any file for this, you can use an ASP.NET
application running as a "background" then you can use it from the front
web application ( all what is required from the framework used is that it
can use the HTTP protocol; I believe all have this feature) , this has the
convenience that you have all the features ; like session; that provide the
ASP.NET framework.

It would looks like this:

C | | Web app 1 |
| A
L | | ASP |---------------------->| S
I | -------------->|--------------| |
P
E |
| .
N | -------------->| Web app 2 | | N
T | | PHP | --------------------->| E
S | | |
| T


Hope this help,
 
Hard to say what is best without more details. Possibly have a CCW for a C#
component (just in a library is fine) that passes the inputs to some stored
procedures, then feeds the resultant datasets through some xslt
transformations. I'm assuming CF can call out to COM objects. You'd also
need a small command-line exe that takes the inputs and forwards them to the
C# component, so that the 3rd-party app can play too.

If you want to avoid writing HTML, would it meet your requirements to just
let the browser render an XML tree?

Regards,
Brad Williams
 
Nicholas,
If my 3rd-party app can call up a URL and pass it a query string then
it seems that I do not need anything other than a simple .Net app with
an aspx page that displays all the info. I also then do not need to
create HTML files on the fly.

What I did not understand was your second paragraph about components
and using the HttpWebRequest and HttpWebResponse classes. What will
this help me achieve? Could you please explain in a little more
detail. I am sorry but this is a 'I do not know enough about the
technology question'.

Nicholas Paldino said:
Rathtap,

Given the requirements, I don't see how it can NOT be an ASP.NET
application. Basically, you would serve up the HTML as needed. The
parameters would come in the form of querystring parameters.

Then, to get the HTML, you would create a component which would make a
request using the HttpWebRequest and HttpWebResponse classes (accessing your
ASP.NET page), download the HTML and then save it or do whatever you want
with it. The component is what you would be distributing, not the ASP.NET
app. It will always connect to your ASP.NET app.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Rathtap said:
I want to write a C# application (lets call it Generator) that will
receive an argument(patient account number) and dynamically generate a
series of linked HTML files (claim information, payments, denials etc)
by querying a database based on the argument. This Generator can be
called from an aspx web page, a Cold Fusion page as well as from a
windows application.
1. Does this C# app have to be a console application to receive
arguments?
2. Is there an easy way to create the HTML file without having to
learn all the HTML syntax?
3. I think it would have been easy enough if it were all within the
ASP.net project itself but because this app needs to be called by a
number of different applications(which are not even .Net apps) I
assume I need a stand-alone generator. Moreover one calling
application is an off-the-shelf third-party product which prevents me
from modifying their code to include the Generator.
This third-party app is however capable of shelling.
4. I assume the calling application should also provide the file name
to be assigned to this generated HTML file because the Generator will
have no way of relaying that information back.
5. Anything else I should be thinking of??
Thanks.
 
Nicholas,
If my 3rd-party app can call up a URL and pass it a query string then
it seems that I do not need anything other than a simple .Net app with
an aspx page that displays all the info. I also then do not need to
create HTML files on the fly.

What I did not understand was your second paragraph about components
and using the HttpWebRequest and HttpWebResponse classes. What will
this help me achieve? Could you please explain in a little more
detail. I am sorry but this is a 'I do not know enough about the
technology question'.
 
Rathtap,

Basically, the class you generate would be a helper class which would
take the parameters in a more friendly format, and then send the request to
your site for the HTML. It would also take the response stream and store it
for use in an easier format (in a string, instead of a stream, perhaps). I
mentioned the HttpWebRequest and HttpWebResponse classes because those are
the classes in the framework that you would use in order to get the HTML
from the ASP.NET site in an easy manner.



Rathtap said:
Nicholas,
If my 3rd-party app can call up a URL and pass it a query string then
it seems that I do not need anything other than a simple .Net app with
an aspx page that displays all the info. I also then do not need to
create HTML files on the fly.

What I did not understand was your second paragraph about components
and using the HttpWebRequest and HttpWebResponse classes. What will
this help me achieve? Could you please explain in a little more
detail. I am sorry but this is a 'I do not know enough about the
technology question'.

"Nicholas Paldino [.NET/C# MVP]" <[email protected]> wrote
in message news: said:
Rathtap,

Given the requirements, I don't see how it can NOT be an ASP.NET
application. Basically, you would serve up the HTML as needed. The
parameters would come in the form of querystring parameters.

Then, to get the HTML, you would create a component which would make a
request using the HttpWebRequest and HttpWebResponse classes (accessing your
ASP.NET page), download the HTML and then save it or do whatever you want
with it. The component is what you would be distributing, not the ASP.NET
app. It will always connect to your ASP.NET app.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Rathtap said:
I want to write a C# application (lets call it Generator) that will
receive an argument(patient account number) and dynamically generate a
series of linked HTML files (claim information, payments, denials etc)
by querying a database based on the argument. This Generator can be
called from an aspx web page, a Cold Fusion page as well as from a
windows application.
1. Does this C# app have to be a console application to receive
arguments?
2. Is there an easy way to create the HTML file without having to
learn all the HTML syntax?
3. I think it would have been easy enough if it were all within the
ASP.net project itself but because this app needs to be called by a
number of different applications(which are not even .Net apps) I
assume I need a stand-alone generator. Moreover one calling
application is an off-the-shelf third-party product which prevents me
from modifying their code to include the Generator.
This third-party app is however capable of shelling.
4. I assume the calling application should also provide the file name
to be assigned to this generated HTML file because the Generator will
have no way of relaying that information back.
5. Anything else I should be thinking of??
Thanks.
 
Thanks for the responses. I am afraid I am missing the main idea here.
More I think about it the more I am convinced that all I need is a
regular ASP.net app with a page that takes in a query string that
contains the account number. It does its work and dislays the info. An
analogy would be the many websites that link up with Mapquest to
display a map based on the query string that is passed to it.
Here I have numerous apps calling 'PatientQuest' with a claim ID in
the query string that then generates the HTML which is sent back in
the browser.
I'm sorry but I still do not see where the following fits in. Thanks
for the patience.
"Basically, the class you generate would be a helper class which would
take the parameters in a more friendly format, and then send the request to
your site for the HTML."
 
Back
Top