473,397 Members | 2,033 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,397 software developers and data experts.

Fileupload - authorization to directories through code?

KK
Hi,

I have two questions

1) In ASP.NET when providing file
upload facility, normaly you have to give
read/write access to the directory. Is
there a way to set this through code?

For example, without setting directory
permissions through file explorer, is it
possible to give permission to IIS anonnymouse
account to access that directory only? May be
using FileIOPermission Attribute?

2) In some code samples, I have seen
they attach the events (say for a button)
on the aspx file itself (using
onclick=Event_Name) and actual code
still is in the code behind file having the
event accessibility set to Public.

But I generaly dont specify onclick=""
but use the event attachment in the
Initialize...() method in page (which is in
the code behind file), in which events have
a Private accessability.

What exactly is the difference?

rgds
KK


Nov 19 '05 #1
1 1038
You should not be able to set permissions programmatically with asp.net.
I would think that would be a security risk. - I have not tried so feel free
to explore.

Another thing that I have not tried but may be able to work is something
called Impersonation. You have asp.net impersonate another user. Well what
would be another user that would have write access to the folder and that
you would always know the password to. The FTP user that you log into. I
have not tried this but logic would seem to explain that if you can
Impersonate the FTP user that you log and ftp files up into that you would
be able to write to folders with that user. Remember that you should read a
good tutorial on asp.net user impersonation and understand all of the
security implications regarding having your password embedded in your code
or etc.


"KK" <kk@kk.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,

I have two questions

1) In ASP.NET when providing file
upload facility, normaly you have to give
read/write access to the directory. Is
there a way to set this through code?

For example, without setting directory
permissions through file explorer, is it
possible to give permission to IIS anonnymouse
account to access that directory only? May be
using FileIOPermission Attribute?

2) In some code samples, I have seen
they attach the events (say for a button)
on the aspx file itself (using
onclick=Event_Name) and actual code
still is in the code behind file having the
event accessibility set to Public.

But I generaly dont specify onclick=""
but use the event attachment in the
Initialize...() method in page (which is in
the code behind file), in which events have
a Private accessability.

What exactly is the difference?

rgds
KK

Nov 19 '05 #2

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

Similar topics

1
by: sonu | last post by:
Mark is creating a website using ASP.NET. He is using Forms authentication for authenticating and authorizing users. He has the following layout of files and directories in his website: Root...
1
by: Marko Vuksanovic | last post by:
I am trying to implement an upload progress indicator using atlas, using the following workaround: http://forums.asp.net/thread/1321664.aspx This is the code in FileUpload.apsx file is as...
12
by: Phil Z. | last post by:
After migrating an ASP.NET 1.1 application to 2.0 we were getting "Cannot access a closed file" errors when uploading. I found a number of post on the subject and have since moved from using an...
0
by: Christian Schlemmer | last post by:
If my code will run into the filesize-limit condition, the INSERT-statement will be executed. is there a way to avoid that? Protected Sub DetailsView1_RowInserting(ByVal sender As Object,...
4
by: Dave | last post by:
If you had a FileUpload control inside of a FormView...how would you use FindControl to access the FileUpload properties? Let me just say that...
3
by: rn5a | last post by:
The ASPX FileUpload control displays a TextBox along with a 'Browse...' Button. Setting the different properties of this control just reflects the changes in the TextBox but not the Button. For...
5
by: =?Utf-8?B?QmVydA==?= | last post by:
Hi How can you set the filename property in the asp:fileupload control? How can you persist the value of the chosen filename between postbacks? thanks B
0
by: ronscottlangham | last post by:
I have a web page that any authenticated user can access, but I dynamically enable/disable other asp.net controls on the web page based on the Role that they are in via C# code behind. My web...
2
by: =?Utf-8?B?UGF1bA==?= | last post by:
I have a gridview with 2 columns. One column is a BoundColumn to a part number (string). One column is an ItemTemplate with a FileUpload control. There can be multiple rows (i.e. part numbers)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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...
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...
0
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,...
0
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...

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.