【问题标题】:How to retrieve docs using Google Drive SDK in Asp.Net如何在 Asp.Net 中使用 Google Drive SDK 检索文档
【发布时间】:2012-11-29 15:18:02
【问题描述】:

我正在开发一个使用 ASP.NET 检索 Google Drive 文档列表的项目,但出现错误:

发生错误:Google.Apis.Requests.RequestError 每日限制 已超过未经验证的使用。继续使用需要注册。 [403]

这是我的网站(此链接出现错误):http://www.netdesklive.com/

我正在为此尝试 DrEdit 代码,但无法正常工作。

我按照https://developers.google.com/drive/examples/dotnet 设置了所有凭据,但仍然出现错误

所以请给我建议

代码:

-> 我在状态和代码中得到空值

public ActionResult Index(string state, string code)
{
    try
    {
        IAuthenticator authenticator = Utils.GetCredentials(code, state);
        // Store the authenticator and the authorized service in session
        Session["authenticator"] = authenticator;
        Session["service"] = Utils.BuildService(authenticator);
    }
    catch (CodeExchangeException)
    {
        if (Session["service"] == null || Session["authenticator"] == null)
        {
            Response.Redirect(Utils.GetAuthorizationUrl("", state));
        }
    }
    catch (NoRefreshTokenException e)
    {
        Response.Redirect(e.AuthorizationUrl);
    }

    DriveState driveState = new DriveState();

    if (!string.IsNullOrEmpty(state))
    {
        JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
        driveState = jsonSerializer.Deserialize<DriveState>(state);
    }

    if (driveState.action == "open")
    {
        return OpenWith(driveState);
    }
    else
    {
        return CreateNew(driveState);
    }
}

【问题讨论】:

  • 嗨,我在这个netdesklive.com/download/DrEdit.rar上放了相关代码
  • 请帮我解决这个问题
  • 您应该取出相关代码并将其发布在问题中。您不能要求任何人下载您的 .rar 并自己找到它。
  • 我在下面放了相关代码,请帮我解决

标签: asp.net google-drive-api


【解决方案1】:

您的错误消息表明您的请求未经授权。您应该使用 Oauth2 授权他们:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-26
    • 2019-11-26
    • 1970-01-01
    • 2012-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-13
    相关资源
    最近更新 更多