473,503 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1874
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3291
by: FC | last post by:
Hello folks, I was wondering if there any other method of achieving the following: I have a XSL transformation outputting a SVG document. For reasons too long to explain here, I must embed a CSS...
2
2315
by: John Sparrow | last post by:
Is it possible to embed (rich) webform controls in an asp.net page? assuming the workstation has IE and the Framework installed of course. Like Java applets? Thanks, John
1
1393
by: PsiMan | last post by:
Is there any way to embed a webform or something similar into another webform so that it renders correctly? I've been using pagelets but find them annoying as they can't be absolutly positioned...
8
1531
by: Bennett Haselton | last post by:
If I create a new C# Web Project in Visual Studio and add this to the Page_Load method for WebForm1: Response.Write("firsttime"); then hitting F5 to debug the project of course shows the...
4
1387
by: HVG | last post by:
Hi, is it possible to render a whole page (ie. a aspx webform) to a string _without_ actually loading the page in a window? Eg if Iam executing page1.aspx at the server, I would then like to...
1
984
by: cksj | last post by:
I have webforms that contain a web user control (ascx). The control is a page header for all of the webforms. In one of the webforms, the data in the web user control is dependent on the webform....
0
1409
by: hq4000 | last post by:
Given AStyleSheet.xsl : <AStyleSheet> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.mytest.mytest2.mytest3.com" version="1.0"> <xsl:output method="xml"...
3
4061
by: Praveen | last post by:
Hi, I have a control that currently embeds it's images and script files as resources (by marking them as 2.0's WebResourceAttribute) and lets the runtime handle the streaming of the files to the...
5
3397
by: Anil Gupte | last post by:
How do I embed Windows Media Player so I can control it with VB code. I am familiar with embedding in a web page like this: *************** <embed src="Test.asx" width=320 height=300...
0
7064
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7315
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7445
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5559
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1492
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.