如何解决此错误信息"htmlfile:访问被拒绝" ...? [英] How to Resolve this errorr "htmlfile: Access is denied"...?
本文介绍了如何解决此错误信息"htmlfile:访问被拒绝" ...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个ASPX页面..
I have this ASPX page..
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.FileSelect
{
background-image: url('../Images/Camera.png');
width: 120px;
height: 90px;
}
</style>
<script type="text/javascript">
function SelectFile() {
document.getElementById('<%= imageUpload.ClientID %>').click();
}
function SubmitForm() {
__doPostBack('btnSubmit', '');
}
function __doPostBack(eventtarget, eventargument) {
document.form1.__EVENTTARGET.value = eventtarget;
document.form1.__EVENTARGUMENT.value = eventargument;
document.form1.submit();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<input type="hidden" id="__EVENTTARGET" value="" />
<input type="hidden" id="__EVENTARGUMENT" value="" />
<input type="button" runat="server" id="btnFileSelect" value="" class="FileSelect" onclick="SelectFile();"/>
<asp:FileUpload ID="imageUpload" runat="server" style="display:none;" onchange="SubmitForm()" />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" style="display:none;" />
</form>
</body>
</html>
并在我的页面后面的代码中是这样的..
and in my code behind page like this..
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
}
那时调用__doPostBack
的行
when __doPostBack
is Called at that time the line
document.form1.submit();
会给我这个错误
"htmlfile:访问被拒绝"
如何解决此问题...
will give me this error
"htmlfile: Access is denied"
how to resolve this...
推荐答案
您无法从FileUpload控件的javascript调用click()方法.也无法使用javascript设置或清除该值.它被认为是违反安全性的行为.但是,您可以读取该值来检查文件扩展名.
一些额外的信息:
http://codecorner.galanter.net/2009/03 /10/fileupload-and-htmlfile-access-is-denied-error/ [ http://jonesie.net.nz/htmlFileAccessDeniedADefenceForMurder.aspx [
You cannot call the click() method from javascript of a FileUpload control. It also isn''t possible to set or clear the value using javascript. It is considered a security violation. You could however read the value to check the file extension for example.
Some extra info:
http://codecorner.galanter.net/2009/03/10/fileupload-and-htmlfile-access-is-denied-error/[^]
http://jonesie.net.nz/htmlFileAccessDeniedADefenceForMurder.aspx[^]
Good luck!
这篇关于如何解决此错误信息"htmlfile:访问被拒绝" ...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文