469,927 Members | 1,857 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Embedding a web page output into asp.net webform (C#)

Hello,

I am trying to embed html output into my webform but could not figure out
how to so far.

The form will execute a Perl script with some parameters, and script will
output some html code. I need to capture and render this html into my
webform.

Any ideas?

Thanks
Nov 19 '05 #1
6 1741
Read the file into a string and set the Text property of a literal to the
value:

StreamReader sr = null;
string content = "";
try
{
sr = new StreamReader("c:\\someFile.html");
content = sr.ReadToEnd();
}finally
{
if (sr != null)
{
sr.Close();
}
}
SomeLiteral.Text = content;

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Skeptical" <sk**@yahoo.com> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
Hello,

I am trying to embed html output into my webform but could not figure out
how to so far.

The form will execute a Perl script with some parameters, and script will
output some html code. I need to capture and render this html into my
webform.

Any ideas?

Thanks

Nov 19 '05 #2
Thanks, but there is no file to read from. The Perl script should be
executed, and then the outputting html should be rendered into the asp.net
webform.

I am basically looking for something like lwp in Perl
http://lwp.linpro.no/lwp/

to get the html and then some method to dynamically render it

Thanks

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uK**************@TK2MSFTNGP15.phx.gbl...
Read the file into a string and set the Text property of a literal to the
value:

StreamReader sr = null;
string content = "";
try
{
sr = new StreamReader("c:\\someFile.html");
content = sr.ReadToEnd();
}finally
{
if (sr != null)
{
sr.Close();
}
}
SomeLiteral.Text = content;

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Skeptical" <sk**@yahoo.com> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
Hello,

I am trying to embed html output into my webform but could not figure out
how to so far.

The form will execute a Perl script with some parameters, and script will
output some html code. I need to capture and render this html into my
webform.

Any ideas?

Thanks


Nov 19 '05 #3
Opps..sorry, should have read your email more closely :)

From the MSDN Process documentation:
http://msdn.microsoft.com/library/de...utputtopic.asp

Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "test.exe";
p.Start();
p.WaitForExit();
string output = p.StandardOutput.ReadToEnd();

Is that more what you are looking for?

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Skeptical" <sk**@yahoo.com> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl...
Thanks, but there is no file to read from. The Perl script should be
executed, and then the outputting html should be rendered into the asp.net
webform.

I am basically looking for something like lwp in Perl
http://lwp.linpro.no/lwp/

to get the html and then some method to dynamically render it

Thanks

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uK**************@TK2MSFTNGP15.phx.gbl...
Read the file into a string and set the Text property of a literal to the value:

StreamReader sr = null;
string content = "";
try
{
sr = new StreamReader("c:\\someFile.html");
content = sr.ReadToEnd();
}finally
{
if (sr != null)
{
sr.Close();
}
}
SomeLiteral.Text = content;

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Skeptical" <sk**@yahoo.com> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
Hello,

I am trying to embed html output into my webform but could not figure out how to so far.

The form will execute a Perl script with some parameters, and script will output some html code. I need to capture and render this html into my
webform.

Any ideas?

Thanks



Nov 19 '05 #4
Nope. I am not trying to run an executable, I am trying to retrieve a web
page into my asp.net webform. Here is an example,

for example let's say we have a webform called test.aspx

when we run test.aspx

we should have something like

private void Page_Load(object sender, System.EventArgs e)

{

Label1.Text="Hello World";

string
x=getpage("http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=asp.net+&btnG=Search");

render(string);

Label2.Text"Bye Bye";

}

getpage() should be able to retrieve all html from the given url, now the
second challenge is to actually render this into the test.aspx so I might
have something like:

Hello World
[
Google Page
]
Bye Bye

I thought Microsoft had already done something similar but I could not find
anything.

Thanks

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:u8*************@TK2MSFTNGP09.phx.gbl...
Opps..sorry, should have read your email more closely :)

From the MSDN Process documentation:
http://msdn.microsoft.com/library/de...utputtopic.asp

Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "test.exe";
p.Start();
p.WaitForExit();
string output = p.StandardOutput.ReadToEnd();

Is that more what you are looking for?

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Skeptical" <sk**@yahoo.com> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl...
Thanks, but there is no file to read from. The Perl script should be
executed, and then the outputting html should be rendered into the
asp.net
webform.

I am basically looking for something like lwp in Perl
http://lwp.linpro.no/lwp/

to get the html and then some method to dynamically render it

Thanks

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uK**************@TK2MSFTNGP15.phx.gbl...
> Read the file into a string and set the Text property of a literal to the > value:
>
> StreamReader sr = null;
> string content = "";
> try
> {
> sr = new StreamReader("c:\\someFile.html");
> content = sr.ReadToEnd();
> }finally
> {
> if (sr != null)
> {
> sr.Close();
> }
> }
> SomeLiteral.Text = content;
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is
> annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
> "Skeptical" <sk**@yahoo.com> wrote in message
> news:O$**************@TK2MSFTNGP10.phx.gbl...
>> Hello,
>>
>> I am trying to embed html output into my webform but could not figure out >> how to so far.
>>
>> The form will execute a Perl script with some parameters, and script will >> output some html code. I need to capture and render this html into my
>> webform.
>>
>> Any ideas?
>>
>> Thanks
>>
>>
>
>



Nov 19 '05 #5
heh...well, we are getting closer :) seems like you want some screen
scraping.. a google search for C# screen scraping should get you somewhere.
You can do it with the HttpWebRequest class, or with a web service.

http://www.csharpfriends.com/Article...?articleID=210

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Skeptical" <sk**@yahoo.com> wrote in message
news:Oi**************@TK2MSFTNGP09.phx.gbl...
Nope. I am not trying to run an executable, I am trying to retrieve a web
page into my asp.net webform. Here is an example,

for example let's say we have a webform called test.aspx

when we run test.aspx

we should have something like

private void Page_Load(object sender, System.EventArgs e)

{

Label1.Text="Hello World";

string
x=getpage("http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.m
ozilla%3Aen-US%3Aofficial&q=asp.net+&btnG=Search");
render(string);

Label2.Text"Bye Bye";

}

getpage() should be able to retrieve all html from the given url, now the
second challenge is to actually render this into the test.aspx so I might
have something like:

Hello World
[
Google Page
]
Bye Bye

I thought Microsoft had already done something similar but I could not find anything.

Thanks

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:u8*************@TK2MSFTNGP09.phx.gbl...
Opps..sorry, should have read your email more closely :)

From the MSDN Process documentation:
http://msdn.microsoft.com/library/de...utputtopic.asp
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "test.exe";
p.Start();
p.WaitForExit();
string output = p.StandardOutput.ReadToEnd();

Is that more what you are looking for?

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Skeptical" <sk**@yahoo.com> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl...
Thanks, but there is no file to read from. The Perl script should be
executed, and then the outputting html should be rendered into the
asp.net
webform.

I am basically looking for something like lwp in Perl
http://lwp.linpro.no/lwp/

to get the html and then some method to dynamically render it

Thanks

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uK**************@TK2MSFTNGP15.phx.gbl...
> Read the file into a string and set the Text property of a literal to

the
> value:
>
> StreamReader sr = null;
> string content = "";
> try
> {
> sr = new StreamReader("c:\\someFile.html");
> content = sr.ReadToEnd();
> }finally
> {
> if (sr != null)
> {
> sr.Close();
> }
> }
> SomeLiteral.Text = content;
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is
> annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to > come!)
> "Skeptical" <sk**@yahoo.com> wrote in message
> news:O$**************@TK2MSFTNGP10.phx.gbl...
>> Hello,
>>
>> I am trying to embed html output into my webform but could not figure
out
>> how to so far.
>>
>> The form will execute a Perl script with some parameters, and script

will
>> output some html code. I need to capture and render this html into

my >> webform.
>>
>> Any ideas?
>>
>> Thanks
>>
>>
>
>



Nov 19 '05 #6
Yay!

That's exactly what I have been talking about! Thanks a bunch...

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:Ok**************@TK2MSFTNGP12.phx.gbl...
heh...well, we are getting closer :) seems like you want some screen
scraping.. a google search for C# screen scraping should get you
somewhere.
You can do it with the HttpWebRequest class, or with a web service.

http://www.csharpfriends.com/Article...?articleID=210

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Skeptical" <sk**@yahoo.com> wrote in message
news:Oi**************@TK2MSFTNGP09.phx.gbl...
Nope. I am not trying to run an executable, I am trying to retrieve a web
page into my asp.net webform. Here is an example,

for example let's say we have a webform called test.aspx

when we run test.aspx

we should have something like

private void Page_Load(object sender, System.EventArgs e)

{

Label1.Text="Hello World";

string

x=getpage("http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.m
ozilla%3Aen-US%3Aofficial&q=asp.net+&btnG=Search");

render(string);

Label2.Text"Bye Bye";

}

getpage() should be able to retrieve all html from the given url, now the
second challenge is to actually render this into the test.aspx so I might
have something like:

Hello World
[
Google Page
]
Bye Bye

I thought Microsoft had already done something similar but I could not

find
anything.

Thanks

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:u8*************@TK2MSFTNGP09.phx.gbl...
> Opps..sorry, should have read your email more closely :)
>
> From the MSDN Process documentation:
> http://msdn.microsoft.com/library/de...utputtopic.asp >
> Process p = new Process();
> p.StartInfo.UseShellExecute = false;
> p.StartInfo.RedirectStandardOutput = true;
> p.StartInfo.FileName = "test.exe";
> p.Start();
> p.WaitForExit();
> string output = p.StandardOutput.ReadToEnd();
>
> Is that more what you are looking for?
>
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is
> annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
> "Skeptical" <sk**@yahoo.com> wrote in message
> news:ua**************@TK2MSFTNGP12.phx.gbl...
>> Thanks, but there is no file to read from. The Perl script should be
>> executed, and then the outputting html should be rendered into the
>> asp.net
>> webform.
>>
>> I am basically looking for something like lwp in Perl
>> http://lwp.linpro.no/lwp/
>>
>> to get the html and then some method to dynamically render it
>>
>> Thanks
>>
>> "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
>> net>
>> wrote in message news:uK**************@TK2MSFTNGP15.phx.gbl...
>> > Read the file into a string and set the Text property of a literal
>> > to
> the
>> > value:
>> >
>> > StreamReader sr = null;
>> > string content = "";
>> > try
>> > {
>> > sr = new StreamReader("c:\\someFile.html");
>> > content = sr.ReadToEnd();
>> > }finally
>> > {
>> > if (sr != null)
>> > {
>> > sr.Close();
>> > }
>> > }
>> > SomeLiteral.Text = content;
>> >
>> > Karl
>> >
>> > --
>> > MY ASP.Net tutorials
>> > http://www.openmymind.net/ - New and Improved (yes, the popup is
>> > annoying)
>> > http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to >> > come!)
>> > "Skeptical" <sk**@yahoo.com> wrote in message
>> > news:O$**************@TK2MSFTNGP10.phx.gbl...
>> >> Hello,
>> >>
>> >> I am trying to embed html output into my webform but could not figure > out
>> >> how to so far.
>> >>
>> >> The form will execute a Perl script with some parameters, and
>> >> script
> will
>> >> output some html code. I need to capture and render this html into my >> >> webform.
>> >>
>> >> Any ideas?
>> >>
>> >> Thanks
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Nov 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by John Sparrow | last post: by
1 post views Thread by PsiMan | last post: by
1 post views Thread by cksj | last post: by
3 posts views Thread by Praveen | last post: by
5 posts views Thread by Anil Gupte | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.