P
Paolo
Hi to all,
I have an error that drove me crazy. Try the following page that should only
allow to upload a file:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server" enctype="multipart/form-data">
<div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Submit"
UseSubmitBehavior="false" />
</div>
</form>
</body>
</html>
The code behind is empty.
Well. It works if you select a file from the Browse button, and it works if
you enter a file name like "C:\text.txt", also if the file doesn't exist,
but it doesn't work if you enter a file name like "pippo.txt".
The javascript error you get is "Access is denied" at the end of the
__doPostBack() function, near the call to "theForm.submit();"
This behaviour has been verified in Intenet explorer 6.0 and 7.0, while it
doesn't occur in Firefox nor in Pocket Internet Explorer. Opera is not
showing any error but doesn't submit the page since the file doesn't exist.
I know that the problem is caused by the UseSubmitBehavior="false"
attribute, because if you remove it, no problems occur.
The fact is that in my code I cannot remove the UseSubmitBehaviour attribute
because I deactivate the buttons when submitting.
Any suggestion?
I'm thinking to verify the text entered in the text area with a regular
expression or something similar. Do you think this would solve the problem
in the proper way?
Regards,
Paolo.
I have an error that drove me crazy. Try the following page that should only
allow to upload a file:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server" enctype="multipart/form-data">
<div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Submit"
UseSubmitBehavior="false" />
</div>
</form>
</body>
</html>
The code behind is empty.
Well. It works if you select a file from the Browse button, and it works if
you enter a file name like "C:\text.txt", also if the file doesn't exist,
but it doesn't work if you enter a file name like "pippo.txt".
The javascript error you get is "Access is denied" at the end of the
__doPostBack() function, near the call to "theForm.submit();"
This behaviour has been verified in Intenet explorer 6.0 and 7.0, while it
doesn't occur in Firefox nor in Pocket Internet Explorer. Opera is not
showing any error but doesn't submit the page since the file doesn't exist.
I know that the problem is caused by the UseSubmitBehavior="false"
attribute, because if you remove it, no problems occur.
The fact is that in my code I cannot remove the UseSubmitBehaviour attribute
because I deactivate the buttons when submitting.
Any suggestion?
I'm thinking to verify the text entered in the text area with a regular
expression or something similar. Do you think this would solve the problem
in the proper way?
Regards,
Paolo.