Difficulty disabling the read-only attribute on an ASP.net working

G

Guest

I have an asp.net application using a multi-page wizard control that grabs
user selected files from a database and allows the user to configure
parameters using controls on the wizard pages. The resultant files are then
submitted for simulations.

When I attempt to navigate through the wizard an exception is thrown because
I am not permitted to overwrite a file in a read-only directory. When I
uncheck the read-only on the folder (subfolders included) my application is
able to overwrite a file once and then the next attempt is hit with an
exception.
I notice that my selection never stays fixed. I can uncheck the read-only
and accept the changes then come back and it will have reset itself. Right
now I am using a folder that resides inside my applications directory. I
kind of liked the idea that all of the applications temporary files could be
found within the applications directory.
I have had some difficulty setting folder attributes to allow applications
to write access to folders. I suspect this is because I am not following
common convention. I would like to be able to deploy my application with
all the correct directory permissions via a setup project or the publishing
tool. I would like to do so in a way that does not cause changes to be made
from my development laptop to my production machine.
I suspect I should probably be using the temporary directory and not
deploying a working directory explicitly. I would like to know the best
practice.

Any advice would be appreciated,

Thanks,

Jeff
 
G

GroupReader

I think the "best practices" would say to put your data folder
*outside* of your web application directory structure. If your data
files are *inside* your website, then users can just navigate directly
to the files and download them using the browser. If you are not
worried about security, then don't worry about it.

When the files are *outside*, then you need to grant access to the
ASPNet worker process. Right click on the folder from file explorer
and give permission to the "user" that runs your asp.net apps. It is
usually "(machine name) \ ASPNET" for IIS 5 & WinXP or "(machine name)
\ Network Service" for IIS 6 and Win2003.

Are you using SourceControl (like visual sourcesafe)? This could be
resetting the read-only attribute whenever you "get latest".
 
G

GroupReader

I think the "best practices" would say to put your data folder
*outside* of your web application directory structure. If your data
files are *inside* your website, then users can just navigate directly
to the files and download them using the browser. If you are not
worried about security, then don't worry about it.

When the files are *outside*, then you need to grant access to the
ASPNet worker process. Right click on the folder from file explorer
and give permission to the "user" that runs your asp.net apps. It is
usually "(machine name) \ ASPNET" for IIS 5 & WinXP or "(machine name)
\ Network Service" for IIS 6 and Win2003.

Are you using SourceControl (like visual sourcesafe)? This could be
resetting the read-only attribute whenever you "get latest".
 
W

Walter Wang [MSFT]

Hi Jeff,

I'm not sure if I've fully understood your question. However, if you're
overwriting a common file in a directory, remember your webpage could be
visited by multiple users at the same time, and they will all write to the
same file. This will certainly overwrite each other's data.

If the file is only used to collect data from user input and will be used
only once (deleted when finished using), then I would recommend use the
temporary file approach. If these files will be needed to keep for each
user, then maybe a database is more appropriate here. For example, you
could use a SQLSERVER Express database or an Access MDB database, both can
be stored at the App_Data folder, which is protected by ASP.NET and cannot
be directly visited by your user.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Walter Wang [MSFT]

Hi Jeff,

How's the status of this post?

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Walter thanks for your quick response.

I am using the session id to generate unique file names so I don't believe I
will have a problem with overwriting. I won't need these files again so I
am leaning toward temp space. I would like to avoid making changes to
permissions at run time.

Thanks again,

Jeff
 
G

Guest

Thanks group reader,

It shouldn't be visual source safe because the problem can occur multiple
times without ever accessing the project. I would like to be able to set any
permissions needed once within the project. I am leaning toward temp space
as I don't need to retain these files and I suspect that Network service
probably already has permissions to this.

Thanks,

Jeff
 
W

Walter Wang [MSFT]

Hi Jeff,

Thanks for the update. Please feel free to let me know if you have anything
else unclear when using the temporary file approach.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top