473,569 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 UseSubmitBehavi or
property set to false. When the UseSubmitBehavi or 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="Def ault.aspx.cs"
Inherits="FileU ploadTest._Defa ult" %>

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

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

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

<asp:LinkButt on id="btnLinkButt on" runat="server"
OnClick="btnUpl oad_Click" Text="Fails" />
<br />

<asp:Button ID="btnSubmitBu tton" runat="server" OnClick="btnUpl oad_Click"
Text="Does nothing" />
<br />

<asp:Button ID="btnButton" runat="server" OnClick="btnUpl oad_Click"
Text="Fails" UseSubmitBehavi or="false" />
<br />

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

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

}

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


Mar 6 '07 #1
0 1566

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

Similar topics

9
1586
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 simply copy that DB onto my site so I could then create the ASP code to access it through a normal Server.CreateObject("ADODB.Connection") ?
4
1393
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 promotion. There's 4 members ... they don't live or work together, have MACs and PCs with different operatimg systems, and they all were hoping to...
2
1385
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 event from the fileupload control. To by-pass this I let the user click on a linkbutton to show the preview, but when the page comes back after the...
35
2533
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 concern since my front-end application will be linked to a SQL SERVER backend. But there seems to be this "conventional wisdom" among IT people...
0
911
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 getting the httpfilecollection looks like this. uploadprogress.aspx?&video_2=C%3A%5CDocuments%20and%20Settings%...
4
6582
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 the textbox. This page does it beautifully: http://msconline.maconstate.edu/tutorials/ASPNET2/ASPNET09/aspnet09-11.aspx But how???
6
2081
by: GaryDean | last post by:
Is there any way to make an asp FileUpload control work within an UpdatePanel? Thanks, Garyh
2
1300
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 functionality over the web, I keep getting an Access Denied error. I am using Forms authentication. I'm not sure if I can or want to implement...
0
843
by: dotNetDone | last post by:
I have a simple fileupload control..... <td> <asp:FileUpload ID="fuData" Width="600px" runat="server" /> </td> code...
5
3296
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 directory for the NETWORK SERVICE account. However, the asp:FileUpload still fails with the following error... ERROR: Request for the permission of type
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8122
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7970
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.