<i id='HxGLw'><tr id='HxGLw'><dt id='HxGLw'><q id='HxGLw'><span id='HxGLw'><b id='HxGLw'><form id='HxGLw'><ins id='HxGLw'></ins><ul id='HxGLw'></ul><sub id='HxGLw'></sub></form><legend id='HxGLw'></legend><bdo id='HxGLw'><pre id='HxGLw'><center id='HxGLw'></center></pre></bdo></b><th id='HxGLw'></th></span></q></dt></tr></i><div id='HxGLw'><tfoot id='HxGLw'></tfoot><dl id='HxGLw'><fieldset id='HxGLw'></fieldset></dl></div>
  • <tfoot id='HxGLw'></tfoot>

      <small id='HxGLw'></small><noframes id='HxGLw'>

      <legend id='HxGLw'><style id='HxGLw'><dir id='HxGLw'><q id='HxGLw'></q></dir></style></legend>

          <bdo id='HxGLw'></bdo><ul id='HxGLw'></ul>

        为什么我得到 System.UnauthorizedAccessException 对路径

        时间:2023-08-28

        <tfoot id='Kq5f8'></tfoot>

        <small id='Kq5f8'></small><noframes id='Kq5f8'>

            <tbody id='Kq5f8'></tbody>

          • <bdo id='Kq5f8'></bdo><ul id='Kq5f8'></ul>
              1. <i id='Kq5f8'><tr id='Kq5f8'><dt id='Kq5f8'><q id='Kq5f8'><span id='Kq5f8'><b id='Kq5f8'><form id='Kq5f8'><ins id='Kq5f8'></ins><ul id='Kq5f8'></ul><sub id='Kq5f8'></sub></form><legend id='Kq5f8'></legend><bdo id='Kq5f8'><pre id='Kq5f8'><center id='Kq5f8'></center></pre></bdo></b><th id='Kq5f8'></th></span></q></dt></tr></i><div id='Kq5f8'><tfoot id='Kq5f8'></tfoot><dl id='Kq5f8'><fieldset id='Kq5f8'></fieldset></dl></div>

              2. <legend id='Kq5f8'><style id='Kq5f8'><dir id='Kq5f8'><q id='Kq5f8'></q></dir></style></legend>
                  本文介绍了为什么我得到 System.UnauthorizedAccessException 对路径“Google.Apis.Auth"的访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我已经实现了用于文件管理的谷歌驱动器功能,它在本地系统中工作正常,但是每当我将它托管在 Godaddy 服务器上时,它都会抛出以下错误

                  I have implemented google drive functionality for file management its working fine in local system but whenever i hosted it on Godaddy server it throw following error

                  System.UnauthorizedAccessException拒绝访问路径Google.Apis.Auth".

                  System.UnauthorizedAccessException Access to the path 'Google.Apis.Auth' is denied.

                  以下代码我正在使用:

                  UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                     new ClientSecrets
                     {
                         ClientId = System.Configuration.ConfigurationManager.AppSettings["GDriveClientId"],//Get ClientID from web.config.
                         ClientSecret = System.Configuration.ConfigurationManager.AppSettings["GDriveClientSecret"]//Get ClientSecret from web.config.
                     },
                     new[] { DriveService.Scope.Drive },
                     System.Configuration.ConfigurationManager.AppSettings["GDriveCreatedByUser"],//Get UserName from web.config.
                     CancellationToken.None).Result;
                  
                  return credential;
                  

                  我正在使用 VS2010,IIS 7 来实现上述功能

                  I am using VS2010,IIS 7 for above functionality

                  推荐答案

                  扩展 Chandrika 已经说过的内容,ASP.NET 用户需要对 Google API 客户端 OAuth2 库的永久存储文件夹的读写权限.

                  Expanding what Chandrika has already said, the ASP.NET user needs read and write permissions to the Google API Client OAuth2 Library's permanent storage folder .

                  其默认值为Environment.SpecialFolder.ApplicationData中名为Google.Apis.Auth"的文件夹(通常对应于C:Usersyour-user-nameAppData漫游).

                  Its default value is a folder named "Google.Apis.Auth" in Environment.SpecialFolder.ApplicationData (which usually corresponds to C:Usersyour-user-nameAppDataRoaming).

                  或者,可以提供另一个文件夹作为 GoogleWebAuthorizationBroker.AuthorizeAsync() 方法:

                  Alternatively, another folder can be provided as the last parameter of the GoogleWebAuthorizationBroker.AuthorizeAsync() method:

                  var folder = System.Web.HttpContext.Current.Server.MapPath("/App_Data/MyGoogleStorage");
                  
                  UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                     new ClientSecrets
                     {
                         ClientId = "PutYourClientIdHere",
                         ClientSecret = "PutYourClientSecretHere"
                     },
                     new[] { DriveService.Scope.Drive },
                     "user",
                     CancellationToken.None,
                     new FileDataStore(folder)).Result;
                  
                  return credential;
                  

                  请参阅:https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth#credentials 和 https://developers.google.com/accounts/docs/OAuth2

                  这篇关于为什么我得到 System.UnauthorizedAccessException 对路径“Google.Apis.Auth"的访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:.NET Google api 1.7 beta 使用刷新令牌进行身份验证 下一篇:Google Drive - 如何从代码中清空垃圾(以编程方式

                  相关文章

                  最新文章

                  • <bdo id='HRdrv'></bdo><ul id='HRdrv'></ul>
                  <i id='HRdrv'><tr id='HRdrv'><dt id='HRdrv'><q id='HRdrv'><span id='HRdrv'><b id='HRdrv'><form id='HRdrv'><ins id='HRdrv'></ins><ul id='HRdrv'></ul><sub id='HRdrv'></sub></form><legend id='HRdrv'></legend><bdo id='HRdrv'><pre id='HRdrv'><center id='HRdrv'></center></pre></bdo></b><th id='HRdrv'></th></span></q></dt></tr></i><div id='HRdrv'><tfoot id='HRdrv'></tfoot><dl id='HRdrv'><fieldset id='HRdrv'></fieldset></dl></div>

                1. <tfoot id='HRdrv'></tfoot>
                  <legend id='HRdrv'><style id='HRdrv'><dir id='HRdrv'><q id='HRdrv'></q></dir></style></legend>
                  1. <small id='HRdrv'></small><noframes id='HRdrv'>