Interview question

Discussion in 'ASP .Net' started by Gopal Krish, Oct 22, 2004.

  1. Gopal Krish

    Gopal Krish Guest

    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?)
     
    Gopal Krish, Oct 22, 2004
    #1
    1. Advertising

  2. Gopal Krish

    Sahil Malik Guest

    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" <> wrote in message
    news:...
    >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?)
     
    Sahil Malik, Oct 22, 2004
    #2
    1. Advertising

  3. Gopal Krish

    Lloyd Dupont Guest

    I'm not sure about what you mean....

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

    "Gopal Krish" <> wrote in message
    news:...
    >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?)
     
    Lloyd Dupont, Oct 22, 2004
    #3
  4. 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" <> wrote in message
    news:...
    > 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?)
     
    John Timney \(Microsoft MVP\), Oct 22, 2004
    #4
  5. Gopal Krish

    Gopal Krish Guest

    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" <> wrote in message news:<e44b1L#>...
    > 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" <> wrote in message
    > news:...
    > >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?)
     
    Gopal Krish, Oct 22, 2004
    #5
  6. Gopal Krish

    Gopal Krish Guest

    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\)" <> wrote in message news:<>...
    > 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" <> wrote in message
    > news:...
    > > 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?)
     
    Gopal Krish, Oct 22, 2004
    #6
  7. Gopal Krish

    Gopal Krish Guest

    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\)" <> wrote in message news:<>...
    > 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" <> wrote in message
    > news:...
    > > 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?)
     
    Gopal Krish, Oct 22, 2004
    #7
  8. > 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" <> wrote in message
    news:...
    > 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" <> wrote in message

    news:<e44b1L#>...
    > > 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" <> wrote in message
    > > news:...
    > > >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?)
     
    Kevin Spencer, Oct 22, 2004
    #8
  9. Gopal Krish

    Sahil Malik Guest

    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" <> wrote in message
    news:...
    > 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" <> wrote in message

    news:<e44b1L#>...
    > > 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" <> wrote in message
    > > news:...
    > > >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?)
     
    Sahil Malik, Oct 22, 2004
    #9
  10. Gopal Krish

    Eric Gibson Guest

    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
     
    Eric Gibson, Oct 22, 2004
    #10
  11. 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" <> wrote in message
    news:...
    > 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" <> wrote in message

    news:<e44b1L#>...
    > > 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" <> wrote in message
    > > news:...
    > > >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?)
     
    John Timney \(Microsoft MVP\), Oct 23, 2004
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Digital Puer
    Replies:
    17
    Views:
    4,124
    Andrew Thompson
    Dec 27, 2003
  2. Jerry

    An interview question

    Jerry, May 27, 2005, in forum: Java
    Replies:
    22
    Views:
    946
    Brooks Hagenow
    Jun 12, 2005
  3. Replies:
    9
    Views:
    463
    Andrey Tarasevich
    Jan 22, 2005
  4. ROSY

    interview question & answer required

    ROSY, Sep 17, 2003, in forum: C Programming
    Replies:
    26
    Views:
    786
    Randy Howard
    Oct 2, 2003
  5. reema
    Replies:
    0
    Views:
    294
    reema
    Aug 26, 2008
Loading...

Share This Page