Server Error in '/' Application. Access to the Path Is Denied" error message appears

把web应用程序上传到服务器上,在添加图片时发生了 Server Error in '/' Application. Access to the Path Is Denied" error message appears 错误,(服务器系统是2003的,)从网上查资料,解决了.方法如下:

就是在要上传图片的文件的属性中的安全中添加一个network server 的用户.给它相应的权限就OK了.比如下面:

"Server Error in '/' Application. Access to the Path <Path> Is Denied" error message appears

Cause

This is caused by the ASP.NET worker process account or the Network Service Group not having sufficient permissions to the Temporary ASP.NET Files folder on the server. This situation can arise depending on the sequence of installing ASP.NET with respect to other Windows options.

Resolution

To resolve this, change the security so that Full Control is allowed for the ASPNET and NETWORK SERVICE accounts on the following folder:

%windir%/Microsoft.NET/Framework/Version/Temporary ASP.NET Files

  1. From the Start Menu, choose All Programs, choose Accessories and then click Windows Explorer.
  2. Expand the folders to point to the Temporary ASP.NET Files folder.
  3. From the File menu, click Properties.
  4. Click the Security tab.
  5. Select the ASPNET user name and choose the Allow Full Control option.
  6. Select the NETWORK SERVICE user name and choose the Allow Full Control option.
  7. Click OK.

The image below shows the Explorer window.

Explorer window

The image below shows the Properties window Security tab.

Properties window Security tab

 我插一句:-), 如果有那个文件或者目录说拒绝访问的话,就在第二步,也就第一个图那里选择特定的文件和目录。

 

 

这个错误提示是因为你的应用程序没有权限访问 "/storage/emulated/0/Video" 这个路径。在 Android 系统中,应用程序需要获得特定的权限才能访问设备上的文件系统。 你可以通过在应用程序的 AndroidManifest.xml 文件中添加以下权限来解决这个问题: ```xml <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> ``` 这个权限将允许你的应用程序访问设备上的外部存储器。同时,还需要在运行时请求该权限,以确保用户已经同意授予应用程序访问外部存储器的权限。你可以使用以下代码在运行时请求该权限: ```java if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE); } ``` 请注意,MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE 是一个自定义请求代码,你需要在 onRequestPermissionsResult 回调方法中处理该请求。 ```java @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // 在此处执行你的操作,已获得 WRITE_EXTERNAL_STORAGE 权限 } else { // 用户拒绝了权限请求 } } } ``` 在你的应用程序中添加这些代码,就可以在运行时请求 WRITE_EXTERNAL_STORAGE 权限,并访问设备上的外部存储器了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值