473,395 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

asp:FileUpload and a non-submit button results in js "Access Denie

I'm trying to upload a file using an asp:FileUpload control and an
asp:LinkButton.
This works fine, while there is an actual filepath in the fileupload upload
control. Even an empty field works. But a bogus filename results in the
"Access Denied" javascript error in IE7.

This also happens when I use an asp:Button with the UseSubmitBehavior
property set to false. When the UseSubmitBehavior is set to true (default),
the button does nothing. This isn't what I want either. Because I want it to
submit so I can check the .HasFile property and show an error message.

It seems that the added javascript submit code triggers IE7 security
routines that come with input type="file".

Is there a way to solve this?

This is the sample code I used:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="FileUploadTest._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:FileUpload ID="fuUpload" runat="server" />
<br />

<asp:LinkButton id="btnLinkButton" runat="server"
OnClick="btnUpload_Click" Text="Fails" />
<br />

<asp:Button ID="btnSubmitButton" runat="server" OnClick="btnUpload_Click"
Text="Does nothing" />
<br />

<asp:Button ID="btnButton" runat="server" OnClick="btnUpload_Click"
Text="Fails" UseSubmitBehavior="false" />
<br />

<asp:Label ID="lblResult" runat="server" />
</div>
</form>
</body>
</html>

pagebehind:
amespace FileUploadTest
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load ( object sender, EventArgs e )
{

}

protected void btnUpload_Click ( object sender, EventArgs e )
{
if (fuUpload.HasFile)
{
lblResult.Text = "Upload Succeeded";
}
else
{
lblResult.Text = "Upload Failed";
}
}
}
}


Mar 6 '07 #1
0 1547

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: A. Webmaster | last post by:
Hi, I am just wondering about something. I would like to use some SQL facilities on my site which doesn't have any SQL Server functionalities. Can I create a Database with Microsoft-ACCESS and...
4
by: SH_on_Google | last post by:
Hello, My input normally regards Access, but thought I'd post this question to a few of my Access groups about a more general database curiosity. I'm helping out a music band that does their own...
2
by: Eric | last post by:
I'm using the fileuploadcontrol for the user to select a file, in this case a image file. I would like to see the little preview image to be shown right after selection, but there seems to be no...
35
by: robert d via AccessMonster.com | last post by:
I was asked to provide a proposal. I provided a proposal on my application and the prospective client likes what I have but is wary of it having been developed in Access. I don't understand this...
0
by: pbd22 | last post by:
hi. i am having probs accessing the HttpFileCollection on the server in VB.NET (using asp.net). the count/length is always zero. the file upload parameters passed to the page that should be...
4
by: bryanp10 | last post by:
How do I do a client-side check to see that a file exists before attempting to upload it? I am trying to avoid the "Access denied" error I get on form submission if an invalid name is entered in...
6
by: GaryDean | last post by:
Is there any way to make an asp FileUpload control work within an UpdatePanel? Thanks, Garyh
2
by: Uriah Piddle | last post by:
Hi Gang, In my asp.net 3.5 website hosted on a shared web server, I need to serve files from a virtual folder within the root folder on the host machine for downloading. When I test the download...
0
by: dotNetDone | last post by:
I have a simple fileupload control..... <td> <asp:FileUpload ID="fuData" Width="600px" runat="server" /> </td> code...
5
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I'm having a problem uploading files to 1&1 using the asp:FileUpload control. Currently, I have direct file writing code (FileStream) working, having set the permissions on the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.