473,654 Members | 3,062 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 1882
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.htm l");
content = sr.ReadToEnd();
}finally
{
if (sr != null)
{
sr.Close();
}
}
SomeLiteral.Tex t = 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$******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP15.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.htm l");
content = sr.ReadToEnd();
}finally
{
if (sr != null)
{
sr.Close();
}
}
SomeLiteral.Tex t = 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$******** ******@TK2MSFTN GP10.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.Use ShellExecute = false;
p.StartInfo.Red irectStandardOu tput = true;
p.StartInfo.Fil eName = "test.exe";
p.Start();
p.WaitForExit() ;
string output = p.StandardOutpu t.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******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP15.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.htm l");
content = sr.ReadToEnd();
}finally
{
if (sr != null)
{
sr.Close();
}
}
SomeLiteral.Tex t = 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$******** ******@TK2MSFTN GP10.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(objec t sender, System.EventArg s e)

{

Label1.Text="He llo World";

string
x=getpage("http ://www.google.com/search?hl=en&lr =&client=firefo x-a&rls=org.mozil la%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******** *****@TK2MSFTNG P09.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.Use ShellExecute = false;
p.StartInfo.Red irectStandardOu tput = true;
p.StartInfo.Fil eName = "test.exe";
p.Start();
p.WaitForExit() ;
string output = p.StandardOutpu t.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******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP15.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.htm l");
> content = sr.ReadToEnd();
> }finally
> {
> if (sr != null)
> {
> sr.Close();
> }
> }
> SomeLiteral.Tex t = 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$******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP09.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(objec t sender, System.EventArg s e)

{

Label1.Text="He llo World";

string
x=getpage("http ://www.google.com/search?hl=en&lr =&client=firefo x-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******** *****@TK2MSFTNG P09.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.Use ShellExecute = false;
p.StartInfo.Red irectStandardOu tput = true;
p.StartInfo.Fil eName = "test.exe";
p.Start();
p.WaitForExit() ;
string output = p.StandardOutpu t.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******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP15.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.htm l");
> content = sr.ReadToEnd();
> }finally
> {
> if (sr != null)
> {
> sr.Close();
> }
> }
> SomeLiteral.Tex t = 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$******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP09.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(objec t sender, System.EventArg s e)

{

Label1.Text="He llo World";

string

x=getpage("http ://www.google.com/search?hl=en&lr =&client=firefo x-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******** *****@TK2MSFTNG P09.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.Use ShellExecute = false;
> p.StartInfo.Red irectStandardOu tput = true;
> p.StartInfo.Fil eName = "test.exe";
> p.Start();
> p.WaitForExit() ;
> string output = p.StandardOutpu t.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******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP15.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.htm l");
>> > content = sr.ReadToEnd();
>> > }finally
>> > {
>> > if (sr != null)
>> > {
>> > sr.Close();
>> > }
>> > }
>> > SomeLiteral.Tex t = 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$******** ******@TK2MSFTN GP10.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
3300
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 style sheet inside a <style> element in the SVG output document using a CDATA block. The CSS stylesheet is not an xml document, therefore I cannot open it using the document function (I suppose, I didn't even try frankly). In order to work...
2
2320
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
1402
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 and don't render when u embed them Cheers Psiman
8
1536
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 WebForm with "firsttime" on the page. But if I then change it to Response.Write("secondtime") and hit F5, the changes don't take effect -- the WebForm still opens and displays
4
1390
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 render page2.aspx to a string _without_ returning to the client. I currently happily override the Render property of a page and capture its html that way, but so far this requires me to postback to the client and open the page in a little window,...
1
994
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. What I would like is for the webform to complete the postback before rendering the user control. Is there way for the user control be processed after the webform is complete? Thanks for any ideas, Cesar
0
1422
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" indent="yes"/> <xsl:template match="/"> <xsl:element name="Test">it works</xsl:element> </xsl:template>
3
4086
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 client. This control now also uses a html file (which gets used as a "dialog" during runtime) and I would like to embed this html file as an assembly resource (just like the above images and scripts) to help make deploying my control's...
5
3402
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 autostart=True type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" name="MediaPlayer1" showcontrols=1 showstatusbar=1</embed> **************** I have also created a WM Player control in a VB Windows Application. But
0
8290
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8489
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7307
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2716
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 we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1596
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.