Are there any good references / guides to this? I couldn't find anything in
the documentation. E.g., are there special interfaces the control needs to
support? How does the control interact with Jscript? Can it fire events,
etc., and generally interact with the rest of the web page?
Furthermore, what security restrictions are placed on the control? Are they
the same as a .NET exe executed from the browser? Can the control make web
services calls back to the same server?
Thanks in advance..
http://www.15seconds.com/Issue/030610.htm
Part of my problems are getting non-trivial programs to work. "Hello world"
is fine, but trying more complicated controls are driving me nuts.
Best of luck,
Dewayne Cushman
"Luther Miller" <luther...@softagondotcom.invalid> wrote in message
news:Ojww%23zWTD...@TK2MSFTNGP10.phx.gbl...
-- The following post helped shed some light.
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.
Lastly you asked can calls be made back to the server, yes. You have to rap
you control within COM(complicated) or use a web service(easier).
I have many URL which talk about creating a user control in IE. So if you
need more let me know.
"Dewayne Cushman" <dcushman at texas dot net> wrote in message
news:u5VSfWHU...@TK2MSFTNGP10.phx.gbl...
Would you mind to post the URLs that you think the most helpful/related to
this subject?
I am trying to write some WMI programs and all I can say is that I am back
to basic as far as .Net security.
Thanks,
"Erick Lee" <eri...@kinetisys.net> wrote in message
news:usZZw6HV...@TK2MSFTNGP12.phx.gbl...
Thanks for that comprehensive article! I haven't seen any single site or
help topic that covers this as well as your last post did.
Could you go ahead and post the URL's that you mentioned so that we may all
benefit from your research?
Thanks again for the great post!
Paul
"Erick Lee" <eri...@kinetisys.net> wrote in message
news:usZZw6HV...@TK2MSFTNGP12.phx.gbl...
> There are many articles on this however none of them really hit on the
most
> troublesome part of this process - security. Many gloss over it and give
---------8<--------------------------