About Application Security(Code Access Security). It dosn't show correct output

T

Tony Johansson

Hi

I have the program below which is from Microsoft Press exam 70-536
When I run this program I get this output
C:\>listpermissions.exe
System.Security.Permissions.FileIOPermission: True
System.Security.Permissions.EnvironmentPermission: True
System.Security.Permissions.FileDialogPermission: True
System.Security.Permissions.IsolatedStorageFilePermission: True
System.Security.Permissions.ReflectionPermission: True
System.Security.Permissions.UIPermission: True
System.Drawing.Printing.PrintingPermission: True

If I run the program in this way I got the same output.
C:\>\\127.0.0.1\c$\listpermissions.exe
System.Security.Permissions.FileIOPermission: True
System.Security.Permissions.EnvironmentPermission: True
System.Security.Permissions.FileDialogPermission: True
System.Security.Permissions.IsolatedStorageFilePermission: True
System.Security.Permissions.ReflectionPermission: True
System.Security.Permissions.UIPermission: True
System.Drawing.Printing.PrintingPermission: True

According to the book I should get false for some of them because when I run
by using 127.0.0.1 it being run from a shared folder, so it is running from
Internet zone
but as you saw I get the same output whether I run it like this
C:\>listpermissions.exe or this C:\>\\127.0.0.1\c$\listpermissions.exe
The permission that the Internet_zone has is
File Dialog
Isolated Storage
Security
User Interface
Printing

class Program
{
static void Main(string[] args)
{
writePermissionState(new
FileIOPermission(PermissionState.Unrestricted));
writePermissionState(new
EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME"));
writePermissionState(new
FileDialogPermission(FileDialogPermissionAccess.Open));
writePermissionState(new
IsolatedStorageFilePermission(PermissionState.Unrestricted));
writePermissionState(new
ReflectionPermission(ReflectionPermissionFlag.MemberAccess));
writePermissionState(new
UIPermission(UIPermissionWindow.SafeTopLevelWindows));
writePermissionState(new
PrintingPermission(PrintingPermissionLevel.SafePrinting));
Console.WriteLine("\nPress Enter key to continue");
Console.Read();
}

static private void writePermissionState(CodeAccessPermission p)
{
// Write True or False depending on whether the user has the
permission
Console.WriteLine(p.GetType().ToString() + ": " +
SecurityManager.IsGranted(p));
}
}

Does anyone has some suggestion why the output is the same it shouldn't be ?

//Tony
 
T

Tony Johansson

GS said:
are you sure 127..0.0.1 is in the internet zone on your pc instead of
local
intranet?

How do I check if it's in the Internet zone or the local internet ?
I mean to judge from the output it would be the local internet and not the
Internet zone.

So why do the book says that it would be the Internet zone ?
Is it possible to configure so 127.0.0.1 would be the Internet zone ?

//Tony
 
K

Karl Mitschke

Hello Tony,
How do I check if it's in the Internet zone or the local internet ?
I mean to judge from the output it would be the local internet and not
the
Internet zone.
So why do the book says that it would be the Internet zone ? Is it
possible to configure so 127.0.0.1 would be the Internet zone ?

//Tony

127.0.0.1 is localhost....

Karl
http://unlockpowershell.wordpress.com
 

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

Top