访问路径'D:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ [英] Access to the path 'D:\PLESKVHOST\vhosts\abhisaartechnologies.com\vns.abhisaartechnologies.com\Upload\resturent.png' is denied.

查看:99
本文介绍了访问路径'D:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

拒绝访问路径'D:\ PLESKVHOST \vhosts \abhisaartechnologies.com \vns.abhisaartechnologies.com \ Upload\resturent.png'。

描述:在执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。



异常详细信息:System.UnauthorizedAccessException:访问路径'D:\\ \\ PLESKVHOST\vhosts\abhisaartechnologies.com\vns.abhisaartechnologies.com\Upload\resturent.png'被拒绝。



ASP.NET不是授权访问所请求的资源。考虑将资源的访问权限授予ASP.NET请求标识。 ASP.NET具有基本进程标识(IIS 5上通常为{MACHINE} \ ASPNET,IIS 6和IIS 7上为网络服务,IIS 7.5上已配置的应用程序池标识),如果应用程序未模拟,则使用该标识。如果应用程序通过< identity impersonate =true>模拟,则身份将是匿名用户(通常是IUSR_MACHINENAME)或经过身份验证的请求用户。



要授予对文件的ASP.NET访问权限,请在文件资源管理器中右键单击该文件,选择属性,然后选择安全选项卡。单击添加以添加适当的用户或组。突出显示ASP.NET帐户,并选中所需访问的框。



来源错误:





第25行:{

第26行:字符串文件名= Path.GetFileName(FileUpload1.PostedFile.FileName);

第27行:FileUpload1 .SaveAs(Server.MapPath(〜/ Upload /+ filename));

第28行:SqlConnection con = new SqlConnection(constr);

第29行:con .Open();





源文件:d:\ pleskvhost \vhosts \ theabhisaartechnologies.com \\\vns.abhisaartechnologies .com\Cpanel\Category.aspx.cs行:27



这是我的代码: -

protected void btnsubmit_Click(对象发送者,EventArgs e)

{

string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);

FileUpload1.SaveAs(Server .MapPath(Upload /+ filename));

SqlConnection con = new SqlConnect ion(constr);

con.Open();

SqlCommand com = new SqlCommand(insert into tbl_CategoryMaster(Category,catId,CatImage)值(@ Category,@ catId,@ CatImage),con);

com.Parameters.AddWithValue(@ Category,SqlDbType.NVarChar).Value = txtcat.Text;

com。 Parameters.AddWithValue(@ catId,SqlDbType.NVarChar).Value = txtid.Text;

com.Parameters.AddWithValue(@ CatImage,filename);

int obj = Convert.ToInt32(com.ExecuteNonQuery());

if(obj> 0)

{

Label1.Text =保存;

}

其他

{

Label1.Text =再试一次;

}

con.Close();

txtcat.Text =;

}

plz帮助我先生如何解决问题

解决方案

设置文件夹权限IIS用户(完全控制)


hi,



由于错误消息明确指出应用程序没有'有权访问。



首先,了解所有IIS用户帐户,并检查您的appPool是否正在运行哪个帐户。



相应地给予权限。



在你的情况下,你必须允许这条路径

 D:\ PLESKVHOST \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ /> 
查看此链接以获取详细信息

http://stackoverflow.com/questions/5729264/what-are-all-the-user-accounts-for-iis-asp-net-和他们有什么不同 [ ^ ]



希望这有帮助。


好的,所以我刚用GoDaddy代表解决了这个问题,让我告诉你这不容易。 

这是您在Plesk管理面板中所做的事情。转到Root目录并将鼠标放在右侧的网站文件夹上。文件夹名称右侧会出现一个小箭头。

一旦你进入那个屏幕,它几乎是不言自明的。单击使用此处显示的条目替换所有子对象上的权限条目复选框,选择应用程序池组并添加修改权限。

然后点击底部的确定按钮,你就可以开始了。

那应该为你解决这个问题。

祝你好运。


Access to the path 'D:\PLESKVHOST\vhosts\abhisaartechnologies.com\vns.abhisaartechnologies.com\Upload\resturent.png' is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path 'D:\PLESKVHOST\vhosts\abhisaartechnologies.com\vns.abhisaartechnologies.com\Upload\resturent.png' is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true">, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in File Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Source Error:


Line 25: {
Line 26: string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
Line 27: FileUpload1.SaveAs(Server.MapPath("~/Upload/" + filename));
Line 28: SqlConnection con = new SqlConnection(constr);
Line 29: con.Open();


Source File: d:\pleskvhost\vhosts\abhisaartechnologies.com\vns.abhisaartechnologies.com\Cpanel\Category.aspx.cs Line: 27

this is my code:--
protected void btnsubmit_Click(object sender, EventArgs e)
{
string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
FileUpload1.SaveAs(Server.MapPath("Upload/" + filename));
SqlConnection con = new SqlConnection(constr);
con.Open();
SqlCommand com = new SqlCommand("Insert into tbl_CategoryMaster (Category,catId,CatImage) values(@Category,@catId,@CatImage)", con);
com.Parameters.AddWithValue("@Category", SqlDbType.NVarChar).Value = txtcat.Text;
com.Parameters.AddWithValue("@catId", SqlDbType.NVarChar).Value = txtid.Text;
com.Parameters.AddWithValue("@CatImage", filename);
int obj = Convert.ToInt32(com.ExecuteNonQuery());
if (obj > 0)
{
Label1.Text = "Save";
}
else
{
Label1.Text = "Try Again";
}
con.Close();
txtcat.Text = "";
}
plz help me sir how to solve problem

解决方案

Set folder Permission IIS user (Full Control)


hi,

As the error message clearly states that the application doesn't have the privilege to access.

First, get to know all the IIS user accounts and check your appPool is running unde which account.

Give the permissions accordingly.

In your case, you have to give permission to this path

D:\PLESKVHOST\vhosts\abhisaartechnologies.com\vns.abhisaartechnologies.com\Upload\



Check this link for detail info
http://stackoverflow.com/questions/5729264/what-are-all-the-user-accounts-for-iis-asp-net-and-how-do-they-differ[^]

Hope this helps.


Ok, so I just worked this issue out with a GoDaddy rep and let me tell you it was not easy.

Here's what you do in Plesk admin panel. Go to the Root directory and put your mouse over your website folder on the right. A tiny arrow shows up on the right of the folder name.

Once you go into that screen it's pretty much self-explanatory. Click the check box for "Replace permission entries on all child objects with the entries displayed here", choose the App Pool Group and add the "Modify" permissions.

Then click on the "Ok" button in the bottom and you're ready to go.

That should fix this issue for you.

Good luck.


这篇关于访问路径'D:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆