473,379 Members | 1,326 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,379 software developers and data experts.

asp:FileUpload permission problem

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
'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Even though I have again set the Modify and Write permissions for the
NETWORK SERVICE account on the directory.

How can I get the permissions working for this control?

Thanks,
Dan

VS2005, .net 2.0.50727
Oct 27 '08 #1
5 3285

On Mon, 27 Oct 2008 13:07:01 +0100, musosdev <mu*******@community.nospam>
wrote:
Even though I have again set the Modify and Write permissions for the
NETWORK SERVICE account on the directory.
Just to make sure if the problem is what you think it is, try to grant
"Everyone" full control on the folder where the file should be written. If
this does not help, revoke the setting and start looking for the problem
in some other location. If it works, revoke the setting and investigate
further whether the application actually runs under the "NETWORK SERVICE"
account.

--
Joern Schou-Rode
http://malamute.dk/
Oct 27 '08 #2
Joern,

I don't actually have access to the "Everyone" permission through my hosts
1&1. I have users... Network Service, an IUSR_xxx account and another user.

I have set all 3 to have Modify and Write permissions, and it hasn't made
any difference.

Any other thoughts?

Thx, Dan

"Joern Schou-Rode" wrote:
>
On Mon, 27 Oct 2008 13:07:01 +0100, musosdev <mu*******@community.nospam>
wrote:
Even though I have again set the Modify and Write permissions for the
NETWORK SERVICE account on the directory.

Just to make sure if the problem is what you think it is, try to grant
"Everyone" full control on the folder where the file should be written. If
this does not help, revoke the setting and start looking for the problem
in some other location. If it works, revoke the setting and investigate
further whether the application actually runs under the "NETWORK SERVICE"
account.

--
Joern Schou-Rode
http://malamute.dk/
Oct 27 '08 #3
On Mon, 27 Oct 2008 14:53:01 +0100, musosdev <mu*******@community.nospam>
wrote:
Any other thoughts?
1) Are you absolutely sure that you are trying to write to the correct
folder?

2) What do you get if you do Response.Write(Environment.UserName) ?

3) Are you able to do System.IO.File.Create(path) and create an empty file
in the folder that way?

--
Joern Schou-Rode
http://malamute.dk/
Oct 27 '08 #4
Hi Joern,

Thanks for the ideas, I've had some interesting results!

1) Yes, double checked this and it's correct.

2) When I try to Response.Write the Environment.User variable, I get the
same security exception as before...

3) This worked! Which is bizare...

My path is as follows "\\_images\\uploads\\", and when using
System.IO.File.Create, I use Server.MapPath.

I also use this with the file upload dialog - do I not need to? I thought
I'd tried it without.

What else could it be? It's interesting that it works with direct file
creation but not with the FileUpload control.

Thanks,
Dan

"Joern Schou-Rode" wrote:
On Mon, 27 Oct 2008 14:53:01 +0100, musosdev <mu*******@community.nospam>
wrote:
Any other thoughts?

1) Are you absolutely sure that you are trying to write to the correct
folder?

2) What do you get if you do Response.Write(Environment.UserName) ?

3) Are you able to do System.IO.File.Create(path) and create an empty file
in the folder that way?

--
Joern Schou-Rode
http://malamute.dk/
Oct 30 '08 #5
Could really do with some more help on this guys...

Thx, Dan.


"musosdev" wrote:
Hi Joern,

Thanks for the ideas, I've had some interesting results!

1) Yes, double checked this and it's correct.

2) When I try to Response.Write the Environment.User variable, I get the
same security exception as before...

3) This worked! Which is bizare...

My path is as follows "\\_images\\uploads\\", and when using
System.IO.File.Create, I use Server.MapPath.

I also use this with the file upload dialog - do I not need to? I thought
I'd tried it without.

What else could it be? It's interesting that it works with direct file
creation but not with the FileUpload control.

Thanks,
Dan

"Joern Schou-Rode" wrote:
On Mon, 27 Oct 2008 14:53:01 +0100, musosdev <mu*******@community.nospam>
wrote:
Any other thoughts?
1) Are you absolutely sure that you are trying to write to the correct
folder?

2) What do you get if you do Response.Write(Environment.UserName) ?

3) Are you able to do System.IO.File.Create(path) and create an empty file
in the folder that way?

--
Joern Schou-Rode
http://malamute.dk/
Nov 2 '08 #6

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

Similar topics

2
by: Jaunty Edward | last post by:
Hi, I am sorry to post this msg here but i could not find any group on ASP. Please forgive me for posting OT msg here but I need to get this ASP program to work with ms access instead of ms SQL......
6
by: Peter Chan | last post by:
For security, I turned off IIS default website and created a new website "MyWebsite". I set allowing script and read for IUser, but asp seems not workable. What should I do? Peter...
3
by: Handy Andy | last post by:
Anyone know how to change the list of file types displayed by the asp:FileUpload control in its file selection dialog, or am I stuck with 'All Files(*.*) Pictures (*.gif, *.jpg) HTML (*.htm,...
2
by: LamSoft | last post by:
When I call the WScript.Shell and "RUN" the object... I've got nothing on the server For Example, objWscript.Run "notepad.exe", True, 1 But on the server side, there is no this process...
0
by: =?Utf-8?B?TGVvbkc=?= | last post by:
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....
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...
1
by: bkeller81 | last post by:
Forgive me if this has been posted but I could not find an answer. I am using <asp:FileUpload ID="FileUpload1" runat="server" /> to allow a user to select a file from their computer. I need is the...
3
by: zensunni | last post by:
This is the code I'm using: set wshell = CreateObject("WScript.Shell") wshell.run "C:\<websitedir>\test.bat" set wshell = nothing I've been getting this error: Microsoft...
2
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys This is a repost as I haven't managed to fix the problem yet. I really hope someone can help as I'm stuck. I have an asp:fileupload component on a page, and it's giving the following...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.