By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,529 Members | 1,899 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,529 IT Pros & Developers. It's quick & easy.

Interview question

P: n/a
I was asked this question in an interview.

How can you display the contents of an ASP page (from another web
server) in a aspx page, ie, first half of the screen will display
contents from asp and the other half will be from the current aspx
page. Using frames is not an option.

Any thoughts? (Is this even possible?)
Nov 18 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
It is possible, right of the top of my head you could always HttpRequest a
page and simply stream it to a string that is coded as
<%=thisstringwillgettherepresentation%>. You might have to clean the body
tag etc. out of it, but it is certainly possible. I am sure if I thought
about it a lil' bit more I could come up with more elegant options.

But I wanna add - yes it is possible, but why in the world would you wanna
do it?

- Sahil Malik
http://www.dotnetjunkies.com/weblog/sahilmalik
"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
I was asked this question in an interview.

How can you display the contents of an ASP page (from another web
server) in a aspx page, ie, first half of the screen will display
contents from asp and the other half will be from the current aspx
page. Using frames is not an option.

Any thoughts? (Is this even possible?)

Nov 18 '05 #2

P: n/a
I'm not sure about what you mean....

anyway what about:
<PRE><% Response.Write(contentString); %></PRE>

"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
I was asked this question in an interview.

How can you display the contents of an ASP page (from another web
server) in a aspx page, ie, first half of the screen will display
contents from asp and the other half will be from the current aspx
page. Using frames is not an option.

Any thoughts? (Is this even possible?)

Nov 18 '05 #3

P: n/a
Request the page using the net httprequest class and output the resulting
string to a panel control

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
I was asked this question in an interview.

How can you display the contents of an ASP page (from another web
server) in a aspx page, ie, first half of the screen will display
contents from asp and the other half will be from the current aspx
page. Using frames is not an option.

Any thoughts? (Is this even possible?)

Nov 18 '05 #4

P: n/a
I couldn't believe someone can ask this in an interview. There is so
much more useful than this one to ask in the interview.

Thanks everone. I'll play with http request class and understand it
better.

"Sahil Malik" <co*****************@nospam.com> wrote in message news:<e4**************@TK2MSFTNGP14.phx.gbl>...
It is possible, right of the top of my head you could always HttpRequest a
page and simply stream it to a string that is coded as
<%=thisstringwillgettherepresentation%>. You might have to clean the body
tag etc. out of it, but it is certainly possible. I am sure if I thought
about it a lil' bit more I could come up with more elegant options.

But I wanna add - yes it is possible, but why in the world would you wanna
do it?

- Sahil Malik
http://www.dotnetjunkies.com/weblog/sahilmalik
"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
I was asked this question in an interview.

How can you display the contents of an ASP page (from another web
server) in a aspx page, ie, first half of the screen will display
contents from asp and the other half will be from the current aspx
page. Using frames is not an option.

Any thoughts? (Is this even possible?)

Nov 18 '05 #5

P: n/a
John,

I looked at the httprequest class and couldn't find any method to
request a page from an external web server.

Could you pls let me know the method name?

"John Timney \(Microsoft MVP\)" <ti*****@despammed.com> wrote in message news:<OT*************@TK2MSFTNGP11.phx.gbl>...
Request the page using the net httprequest class and output the resulting
string to a panel control

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
I was asked this question in an interview.

How can you display the contents of an ASP page (from another web
server) in a aspx page, ie, first half of the screen will display
contents from asp and the other half will be from the current aspx
page. Using frames is not an option.

Any thoughts? (Is this even possible?)

Nov 18 '05 #6

P: n/a
The .NET documentation on HttpRequest talk only about dealing with the
current web server. There is not much information anywhere on google
on requesting web pages from external web servers,

Finally after much trial and error and with few rate samples, I have
done it. Thought I'll post it here. incase anyone needs it.

HttpWebRequest HttpWReq =
(HttpWebRequest)WebRequest.Create("http://www.yahoo.com");
HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse();
StreamReader streamReader = new
StreamReader(HttpWResp.GetResponseStream());
string s = streamReader.ReadToEnd();
streamReader.Close();
HttpWResp.Close();
Label myL = new Label();
myL.Text = s;
Panel1.Controls.Add(myL);

"John Timney \(Microsoft MVP\)" <ti*****@despammed.com> wrote in message news:<OT*************@TK2MSFTNGP11.phx.gbl>...
Request the page using the net httprequest class and output the resulting
string to a panel control

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
I was asked this question in an interview.

How can you display the contents of an ASP page (from another web
server) in a aspx page, ie, first half of the screen will display
contents from asp and the other half will be from the current aspx
page. Using frames is not an option.

Any thoughts? (Is this even possible?)

Nov 18 '05 #7

P: n/a
> I couldn't believe someone can ask this in an interview. There is so
much more useful than this one to ask in the interview.
Hey, you had to ask someone else for the answer. Offhand, I would say that
it is a very good question, in that it identifies the level of knowledge of
the interviewee. You, for example, were unable to answer it during the
interview.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om... I couldn't believe someone can ask this in an interview. There is so
much more useful than this one to ask in the interview.

Thanks everone. I'll play with http request class and understand it
better.

"Sahil Malik" <co*****************@nospam.com> wrote in message

news:<e4**************@TK2MSFTNGP14.phx.gbl>...
It is possible, right of the top of my head you could always HttpRequest a page and simply stream it to a string that is coded as
<%=thisstringwillgettherepresentation%>. You might have to clean the body tag etc. out of it, but it is certainly possible. I am sure if I thought about it a lil' bit more I could come up with more elegant options.

But I wanna add - yes it is possible, but why in the world would you wanna do it?

- Sahil Malik
http://www.dotnetjunkies.com/weblog/sahilmalik
"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
I was asked this question in an interview.

How can you display the contents of an ASP page (from another web
server) in a aspx page, ie, first half of the screen will display
contents from asp and the other half will be from the current aspx
page. Using frames is not an option.

Any thoughts? (Is this even possible?)

Nov 18 '05 #8

P: n/a
Think about it, it is really a good question. You'd only be able to answer
it if you have gone to the very depths of ASP.NET.

- Sahil Malik
http://www.dotnetjunkies.com/weblog/sahilmalik
Please reply to the newsgroups instead of email so everyone can benefit from
your reply.
"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
I couldn't believe someone can ask this in an interview. There is so
much more useful than this one to ask in the interview.

Thanks everone. I'll play with http request class and understand it
better.

"Sahil Malik" <co*****************@nospam.com> wrote in message

news:<e4**************@TK2MSFTNGP14.phx.gbl>...
It is possible, right of the top of my head you could always HttpRequest a page and simply stream it to a string that is coded as
<%=thisstringwillgettherepresentation%>. You might have to clean the body tag etc. out of it, but it is certainly possible. I am sure if I thought about it a lil' bit more I could come up with more elegant options.

But I wanna add - yes it is possible, but why in the world would you wanna do it?

- Sahil Malik
http://www.dotnetjunkies.com/weblog/sahilmalik
"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
I was asked this question in an interview.

How can you display the contents of an ASP page (from another web
server) in a aspx page, ie, first half of the screen will display
contents from asp and the other half will be from the current aspx
page. Using frames is not an option.

Any thoughts? (Is this even possible?)

Nov 18 '05 #9

P: n/a
Gopal Krish wrote:
I couldn't believe someone can ask this in an interview. There is so
much more useful than this one to ask in the interview.

Thanks everone. I'll play with http request class and understand it
better.


I've been using "screen scraping" for the past couple days actually. It's
pretty useful...

Eric
Nov 18 '05 #10

P: n/a
A question like this would test your understanding of the framework and its
underlying classes, methods and namespaces, rather than your ability to
code.

I ask much harder questions than this when I interview to help determine the
depth of technical understanding that the candidate has. Many people can
use an IDE, but not many understand what it does behind the scenes, and how
the ASP pipeline works.

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
I couldn't believe someone can ask this in an interview. There is so
much more useful than this one to ask in the interview.

Thanks everone. I'll play with http request class and understand it
better.

"Sahil Malik" <co*****************@nospam.com> wrote in message

news:<e4**************@TK2MSFTNGP14.phx.gbl>...
It is possible, right of the top of my head you could always HttpRequest a page and simply stream it to a string that is coded as
<%=thisstringwillgettherepresentation%>. You might have to clean the body tag etc. out of it, but it is certainly possible. I am sure if I thought about it a lil' bit more I could come up with more elegant options.

But I wanna add - yes it is possible, but why in the world would you wanna do it?

- Sahil Malik
http://www.dotnetjunkies.com/weblog/sahilmalik
"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
I was asked this question in an interview.

How can you display the contents of an ASP page (from another web
server) in a aspx page, ie, first half of the screen will display
contents from asp and the other half will be from the current aspx
page. Using frames is not an option.

Any thoughts? (Is this even possible?)

Nov 18 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.