Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在ASP.Net应用程序的IFRAME中显示Google文档_Iframe_Google Docs_Google Docs Api_Google Oauth - Fatal编程技术网

在ASP.Net应用程序的IFRAME中显示Google文档

在ASP.Net应用程序的IFRAME中显示Google文档,iframe,google-docs,google-docs-api,google-oauth,Iframe,Google Docs,Google Docs Api,Google Oauth,我正在开发一个.net应用程序,它允许用户将google文档链接附加到应用程序,并从应用程序本身查看/编辑它们。我使用iFrame将google文档嵌入到我的应用程序中 由于应用程序中的GoogleDoc嵌入应该离线进行,所以我使用GoogleAPI中的访问令牌来获取URL并显示。我在这方面有显示问题 我已经做了所有与获取访问令牌相关的事情,这些令牌是根据谷歌API文档“离线”打开谷歌文档所必需的。根据GoogleAPI开发者文档,在打开GoogleDocURL时,我需要将访问令牌作为查询参数或

我正在开发一个.net应用程序,它允许用户将google文档链接附加到应用程序,并从应用程序本身查看/编辑它们。我使用iFrame将google文档嵌入到我的应用程序中

由于应用程序中的GoogleDoc嵌入应该离线进行,所以我使用GoogleAPI中的访问令牌来获取URL并显示。我在这方面有显示问题

我已经做了所有与获取访问令牌相关的事情,这些令牌是根据谷歌API文档“离线”打开谷歌文档所必需的。根据GoogleAPI开发者文档,在打开GoogleDocURL时,我需要将访问令牌作为查询参数或请求头(“授权”头)传递

我尝试使用授权标题,并使用HttpWebRequest对象打开了google文档url,但没有正确打开文档页面

aspx文件中的代码 浏览器确实打开了谷歌文档,但一旦打开,它就会一直说“正在尝试连接到谷歌”,并不断弹出警报说“服务器没有响应”

因此,我尝试使用访问令牌作为URL链接的查询参数,但这似乎根本不起作用。 如: URL链接=”

并将此url设置为iframe src

<iframe src=urlLink>

有人能帮我正确显示谷歌文档吗(在编辑模式下)在我的web应用程序中的IFRAME中

我认为google docs使用HTTPS,这意味着你不能在你的网站上嵌入HTTPS网站。我以前尝试过用IFRAME嵌入具有HTTPS或ssl证书的网站,所以我得出了这个结论。

如果是这样的话,那么我可以在一个选项卡中登录gmail帐户,然后打开我的web应用程序在另一个选项卡中,我可以将iframe src设置为google docs,它可以正确显示,我可以编辑文档
// get the UrlLink from the Query Parameter (url) 
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(urlLink);
myHttpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like 
                               Gecko) Chrome/27.0.1453.116    Safari/537.36"; 
myHttpWebRequest.Headers.Add("Authorization", "Bearer " + accessToken); 
string pageContent = string.Empty; 
HttpWebResponse HttpWResp = (HttpWebResponse)myHttpWebRequest.GetResponse();
if (HttpWResp != null)
{
    StreamReader sr = new StreamReader(HttpWResp.GetResponseStream());
    pageContent = sr.ReadToEnd();
}
context.Response.ContentType = HttpWResp.ContentType;
context.Response.Write(pageContent);
<iframe src=urlLink>
var jqXHR = $.ajax({
            async: true,
            url: url,
            type: 'GET',
            xhr: function () {
                var xhr = new window.XMLHttpRequest();
                return xhr;
            },
            beforeSend: function (xhr) {
                if (xhr != null)
                    xhr.setRequestHeader("Authorization", "Bearer " + token);
            }
        });

        jqXHR.done(function (data, textStatus, xhr) {
            $("#myFrame").contents().find("html").html(xhr.responseText);
        });