473,395 Members | 1,676 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.

Declaritive security attribute help!

I am trying to tag an assembly with a minimum requirements check so that it
will know if it has the ability to read and write to a specific folder.

The problem is that the specific folder is a sub folder of the users
ApplicationData folder.

Anyone have any examples of how to do this? I have been looking in the help
and Googling for the last few hours and can't seem to find an example of
this.

I set up a small test project that uses the following line to check before
it draws the main form:

<Assembly:
Security.Permissions.FileIOPermission(Security.Per missions.SecurityAction.RequestMinimum,
All:=Nothing, Append:=Nothing, PathDiscovery:=Nothing, Read:="C:\Documents
and Settings\rcassick\Application Data\Enterprocity", Unrestricted:=False,
Write:="C:\Documents and Settings\rcassick\Application Data\Enterprocity")>

and then I ran it from an account that I KNOW has no ability to read or
write form that path and it did not seem to do anything at all. I was
expecting at least to get some Security Exception window.
--
Raymond R Cassick
CEO / CSA
Enterprocity Inc.
www.enterprocity.com
3380 Sheridan Drive, #143
Amherst, NY 14227
V: 716-316-5973
Blog: http://spaces.msn.com/members/rcassick/
Nov 25 '05 #1
2 1209
Hi,

Take a look at this example. It shows how to request a permission
and check and see if you can do.

http://msdn.microsoft.com/library/de...sctorTopic.asp

Ken
-----------------------
"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message
news:eD*************@TK2MSFTNGP09.phx.gbl...
I am trying to tag an assembly with a minimum requirements check so that it
will know if it has the ability to read and write to a specific folder.

The problem is that the specific folder is a sub folder of the users
ApplicationData folder.

Anyone have any examples of how to do this? I have been looking in the
help and Googling for the last few hours and can't seem to find an example
of this.

I set up a small test project that uses the following line to check before
it draws the main form:

<Assembly:
Security.Permissions.FileIOPermission(Security.Per missions.SecurityAction.RequestMinimum,
All:=Nothing, Append:=Nothing, PathDiscovery:=Nothing, Read:="C:\Documents
and Settings\rcassick\Application Data\Enterprocity", Unrestricted:=False,
Write:="C:\Documents and Settings\rcassick\Application
Data\Enterprocity")>

and then I ran it from an account that I KNOW has no ability to read or
write form that path and it did not seem to do anything at all. I was
expecting at least to get some Security Exception window.
--
Raymond R Cassick
CEO / CSA
Enterprocity Inc.
www.enterprocity.com
3380 Sheridan Drive, #143
Amherst, NY 14227
V: 716-316-5973
Blog: http://spaces.msn.com/members/rcassick/

Nov 27 '05 #2
Is there a way though to use a path that changes depending on the logged on
user and still do this declaratively? I don't think so.

The path I am after in as user specific Application Data path.

I don't think I can do this declaratively.

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl...
Hi,

Take a look at this example. It shows how to request a permission
and check and see if you can do.

http://msdn.microsoft.com/library/de...sctorTopic.asp

Ken
-----------------------
"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message
news:eD*************@TK2MSFTNGP09.phx.gbl...
I am trying to tag an assembly with a minimum requirements check so that
it will know if it has the ability to read and write to a specific folder.

The problem is that the specific folder is a sub folder of the users
ApplicationData folder.

Anyone have any examples of how to do this? I have been looking in the
help and Googling for the last few hours and can't seem to find an
example of this.

I set up a small test project that uses the following line to check
before it draws the main form:

<Assembly:
Security.Permissions.FileIOPermission(Security.Per missions.SecurityAction.RequestMinimum,
All:=Nothing, Append:=Nothing, PathDiscovery:=Nothing,
Read:="C:\Documents and Settings\rcassick\Application Data\Enterprocity",
Unrestricted:=False, Write:="C:\Documents and
Settings\rcassick\Application Data\Enterprocity")>

and then I ran it from an account that I KNOW has no ability to read or
write form that path and it did not seem to do anything at all. I was
expecting at least to get some Security Exception window.
--
Raymond R Cassick
CEO / CSA
Enterprocity Inc.
www.enterprocity.com
3380 Sheridan Drive, #143
Amherst, NY 14227
V: 716-316-5973
Blog: http://spaces.msn.com/members/rcassick/


Nov 27 '05 #3

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

Similar topics

9
by: Terry E Dow | last post by:
Howdy, I am having trouble with the objectCategory=group member.Count attribute. I get one of three counts, a number between 1-999, no member (does not contain member property), or 0. Using...
8
by: William Stacey [MVP] | last post by:
What if we had some kind on declarative synchronization where you could declare, in declaration section, different lock sets for your invariant? Something like: public class MyClass {...
6
by: pradeep_TP | last post by:
I am facing a strange problem with my web site. Afer reinstalling the web application on the web server, I am getting a dialog box for each page. The dialog box has the following information. ...
5
by: Norsoft | last post by:
I have a .Net 1.1 application which is downloaded into an aspx page. It is a dll which inherits from System.Windows.Forms.UserControl. It works fine on a PC with only the 1.1 Framework. However,...
0
by: Rich Forman | last post by:
Hey guys, VB.NET question: I want my app to overwrite files in its own directory with later-version-#'s of the same files that it finds in a designated "updates" directory. It works great when...
3
by: Ray Cassick \(Home\) | last post by:
I have some code that looks like this for one of my classes: Imports System.Security Imports System.Security.Permissions Imports System.Security.Principal ...
1
by: joel | last post by:
I've made a windows form application and started placing security attributes on the assembly. When I use these attributes I always get an annoying ballon on the app with the following text ...
1
by: Martin | last post by:
Hi all, Those days, I explore the System.Security namespace but, of course, I have a question. I really appreciate the way we can secure a method with the PrincipalPermissionAttribute above...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.