0

Let's say i want my default.aspx page to present the content of www.google.com (for example).
Is it a Redirect? or can it be "Embedded"?

The goal is to see the content of the Web page, and get a response from it.

In more details, I want to authenticate a user according to GoogleDrive SDK.

I ALREADY have the Auth Url from another place.
So here I want to run this Url, wait for the user to accept the app, and to receive the response tokens (Access token, Refresh token) from the Google authorization page.

I hope I could explain it clearly.

*I must say, the whole auth process is working well in WinForms, but I need to split the process. I'm getting the Url from there, but need to get the response in a different webform app.

Is it possible?

user990635
  • 3,979
  • 13
  • 45
  • 66

1 Answers1

1

It is done with the html5 iframe tag: See http://www.gcsdstaff.org/roodhouse/?p=2158 and http://www.quackit.com/html_5/tags/html_iframe_tag.cfm

Tarik
  • 10,810
  • 2
  • 26
  • 40
  • "The reason for this is, that Google is sending an "X-Frame-Options: SAMEORIGIN" response header. This option prevents the browser from displaying iFrames that are not hosted on the same domain as the parent page." (from: http://stackoverflow.com/questions/8700636/how-to-show-google-com-in-an-iframe) – user990635 Aug 27 '13 at 09:27
  • @user990635 Thanks for your clarification. The other ways I can think of at this point is to capture and parse the whole Google web page through Javascript and dynamically embed the content into the page. That would be client side. The other way would be to act as a URL proxy and have any request to Google be chaneled through your web site that would go and grab the response from Google and serve it back to the browser. The second solution would cause Google to detect your web server as a bot and challenge you with a captcha. – Tarik Aug 27 '13 at 09:38
  • Thanks! Can you explain in more details the first option? – user990635 Aug 27 '13 at 09:43
  • See http://stackoverflow.com/questions/10642289/return-html-content-as-a-string-given-url-javascript-function that provides code on how to do that. You will have to adapt it to your needs though. – Tarik Aug 27 '13 at 10:14
  • I am afraid, you will soon have to learn Chinese :-) ... or hire someone to code. – Tarik Aug 27 '13 at 10:41
  • What the code snippet is doing is: 1) Instantiating the XMLHttpRequest, requesting the URL, getting the response text and putting it in the web page. All of this is happening in the browser. You need to do something similar, stripping off the unneeded parts of the html that you grab from Google. Not obvious though... I wonder if the "X-Frame-Options: SAMEORIGIN" response header will not prevent you from doing so. Check the provided example before going further. These restrictions are due to avoid cross site scripting attacks: see http://en.wikipedia.org/wiki/Cross-site_scripting – Tarik Aug 27 '13 at 10:49