Re: intranet permissions

From: Shel Blauman [MSFT] (sheldonb_at_online.microsoft.com)
Date: 05/13/03


Date: Tue, 13 May 2003 08:29:16 -0700


Think this may help.

Shel

How to run a user control assembly hosted on an Internet Information Server
(IIS) on an Internet Explorer (IE) client.

The following applies to an assembly intended to execute with greater
permissions than would normally be granted to the zone the assembly belongs
to, most likely Internet, Local Intranet or Trusted Sites.

  1.. The user control assembly is identifiable in a manner that can be used
to set the membership condition in a code group either using the .NET
Configuration Tool (Mscorcfg.msc) or caspol.exe. Signing using a strong
name or a certificate is preferable, but other sources of identity such as a
URL or site can also be used. Although a URL or site can serve as a
membership condition, they are not recommended, as they are not as secure as
a strong name or a certificate.

To create a strong name use sn.exe:

sn -k keyPair.snk

// This strong name key is used to create a code group that gives //
permissions to this assembly.

// Sign the assembly with the strong name key.

[assembly: AssemblyKeyFile("keyPair.snk")]

  2.. If strong named, the user control has the
AllowedPartiallyTrustedCallers attribute.

// The AllowPartiallyTrustedCallersAttribute requires the assembly to // be
signed with a strong name key.

// This attribute is necessary since the control is called by either an //
intranet or Internet Web page that should be running under //
restricted permissions.

// The fully attributed assembly should look similar to the following:

[assembly: AssemblyKeyFile("snKey.snk")]

[assembly: AssemblyVersion("1.0.0.0")]

[assembly:AllowPartiallyTrustedCallers]

namespace SignedAssembly

  3.. The user control asserts permissions it requires which the zone in
which it is running would not normally be granted. Permissions should only
be asserted if it is positively known the calling application has
insufficient permissions. Asserts should not be performed without a strong
need.
new FileIOPermission(PermissionState.Unrestricted).Assert();

            textBox1.Text = fileDialog.FileName;

            // Display the contents of the file in the text box.

FileStream fsIn = new FileStream(textBox1.Text, FileMode.Open,
FileAccess.Read, FileShare.Read);

            StreamReader sr = new StreamReader(fsIn);

            // Process every line in the file

for (String Line = sr.ReadLine(); Line != null; Line = sr.ReadLine())

            {

                  listBox1.Items.Add(Line);

            }

// It is very important to call RevertAssert to restore the stack walk //
for file operations.

                  FileIOPermission.RevertAssert();

  4.. The user control RevertAsserts immediately after performing asserted
actions.
// It is very important to call RevertAssert to restore the stack walk //
for file operations.

                  FileIOPermission.RevertAssert();

  5.. The user control is hosted in an IIS folder on the server that has an
"Execute permission" set to either "None" or "Scripts Only".

  6.. The client has a code group that the assembly resolves to that grants
the permissions the assembly requires.
caspol -machine -addgroup All_Code -strong -file signedassembly.exe
FullTrust -name FouthCoffeeStrongName -description "Code group granting
trust to code signed by FourthCoffee"

Alternatively, the code group can be created using the Microsoft .NET
Framework Configuration tool (Mscorcfg.msc) found under Administrative
Tools.

  7.. In Internet Explorer, Internet Options, Advanced Security settings,
the "Do not save encrypted pages to disk" should be unchecked if Internet
Explorer Enhanced Security Configuration has been enabled for both
Administrators and for Other Groups on the server. The Internet Explorer
Enhanced Security setting selected is the default on Windows Server 2003.
When in effect, one of the invoked features is the encryption of downloaded
files. Another feature is the automatic setting of "Do not save encrypted
pages to disk" on the client. To successfully download a user control under
these conditions, the client setting for "Do not save encrypted pages to
disk" should be cleared. This functionality is found in Control Panel, Add
or Remove Programs, Add/Remove Windows Components, Internet Explorer
Enhanced Security Configuration.

  8.. The runtime version on the client machine is compatible with the used
to compile the assembly.

  9.. The code group created for the user control is in the same runtime
that the control uses.

If problems occur, check the Fusionbinderror log in "C:\Documents and
Settings\<username>\Local Settings\Temporary Internet Files" to determine
which operations failed. This log must first be copied to another folder
before it can be opened.

-- 
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Michelle" <michelle@nospam.com> wrote in message
news:eS0StJMGDHA.2344@TK2MSFTNGP12.phx.gbl...
> I'm trying to make a simple webbrowser with the "Microsft Web Browser"
> control. It works fine on my computer, but when i try to run the program
> from a intranet location, i get a security exception. I could set for each
> computer to accept the program, but for me, is impossible to do this. So,
i
> wanna know whether there is any solution by code.
>
> Thanks.
>
>
>


Relevant Pages

  • Re: Download behavior of .exe assembly
    ... Use the IEHost Log to Debug .NET Object Hosting in Internet Explorer. ... permissions than would normally be granted to the zone the assembly belongs ... Framework Configuration tool found under Administrative ... Enhanced Security setting selected is the default on Windows Server 2003. ...
    (microsoft.public.dotnet.security)
  • Re: Need Help In Sharing Files/Folders
    ... Permissions for shares affect only users try to connect to that share from another ... to a computer locally and network users. ... folder may have excessive permissions for users/everyone that you may want to change] ... restricting user access to Internet Explorer Control Panel settings to greatly reduce ...
    (microsoft.public.win2000.security)
  • Re: Problem with permissions
    ... You need to set the correct NTFS permissions. ... "Internet Explorer May Prompt You for a Password" ... > application installed on a local member server. ... > the app through IE, I get a permissions error which says: ...
    (microsoft.public.inetserver.iis)
  • RE: Cannot modify "Advanced Internet Settings"
    ... Something had changed the permissions on the Internet Explorer entries in the registry, so that I no longer had the permission to alter settings. ... > IE6 insists on script debugging and displaying debug messages, despite being set NOT to debug and NOT to display messages ... The unwanted script debugging seems to have started when I installed Zone Alarm Integrity, but ZA is useless as far as support. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Firewall Client Question
    ... The default registry and file permissions are outside the scope of a single product. ... client configuration. ... the Registry Key and Everyone Full Control. ... > Wspcfg.ini is application-specific and does not apply to the FWC itself. ...
    (microsoft.public.isa.clients)

Loading