I moved call to the page load, but it still did not return the env
variable.
Thanks for your suggestion, B
"Alvin Bruney [ASP.NET MVP]" <
www.lulu.com/owc> wrote in message
Hold on, why can't you simply access the environment variable, the
worker process should have rights to it. For instance, this code on a
web page returns the name of my computer
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Environment.MachineName);
}
Modify the code to return what you want.
--
--
Regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on
www.lulu.com/owc $19.99
Alvin,
It is the FileIOPermissionAccess.PathDiscovery permission I want to
set. (I'm trying to get the value of
Environment.SpecialFolder.ApplicationData)
In the msdn examples we get::
FileIOPermission f2 = new
FileIOPermission(FileIOPermissionAccess.Read, "C:\\test_r");
f2.AddPathList(FileIOPermissionAccess.Write |
FileIOPermissionAccess.Read, "C:\\example\\out.txt");
But I cannot figure out the call to set PathDiscovery permission as it
has no path?, and there appears to be no signature for it?
thanks, B
"Alvin Bruney [ASP.NET MVP]" <
www.lulu.com/owc> wrote in message
One way is to create an assembly that has an attribute that demands
the fileIOPermissionAccess permission. Inside the assembly, you can
create a method that does the dirty work. The downside with this is
that the entire class has the permissions, if you want to restrict it
to just a method, you can demand the permission thru code. There's a
link with an implementation sample here:
http://msdn2.microsoft.com/en-us/library/system.security.permissions.fileiopermission.aspx.
Read the pre-requesits VERY carefully. These are strong permissions
you are asking for and there is a very real potential for you, your
code, or rogue code to subvert or compromise the sub-system.
--
--
Regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on
www.lulu.com/owc $19.99
Alvin,
Do you know how I give a user FileIOPermissionAccess.PathDiscovery
permission? Is it via the Group Policy editor?
thanks
"Alvin Bruney [ASP.NET MVP]" <
www.lulu.com/owc> wrote in message
One way is to create an account that has the required permission
and impersonate that user through code.
--
--
Regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on
www.lulu.com/owc $19.99
How can I give the logged in User
FileIOPermissionAccess.PathDiscovery permission to execute a
Environment.SpecialFolder.ApplicationData method ?
thanks Brian,