|
Orion
Buttigieg
|
|
6/21/2002 4:03:18 PM
|
Not rated
|
hello,
i've followed a couple of examples including one posted on this site. the examples all use the <object>tag to state the id and classid.
it seems no matter what i do the object will only render itself as a text box in the size of the width and height values i've given. the control is simple. its just 2 buttons and 2 text boxes. i haven't called any functions or anything.
i've tested both IE 5.5 and 6.0. yes, .NET resides on both machines i've tested.
the one example is: http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=187
hope someone can shed some light.
thanks, Orion
|
|
Heath
Stewart
|
|
6/21/2002 11:53:30 PM
|
Not rated
|
Orion, try this tutorial: http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=388. It's more extensive than Andrew's and may solve your problems.
Also, have you changed any security settings? The fact that it renders as a text box is interesting. Post it on the site and I can setup a code group using the SiteMembershipCondition to give your control FullTrust. Are you sure you changed <a>ALL the SystemColors referenced in your control to standard Colors? If you don't, the control won't execute in the IEHost trusted host application (which IE uses to host .NET controls).
|
|
Andrew
Ma
|
|
Orion
Buttigieg
|
|
6/24/2002 11:04:07 AM
|
Not rated
|
Thank you both for giving me a hand. still having some trouble but at least now i know where to look. Heath, it turns out, because i was using "control" as a color, no color code was being inserted.
Thanks again for your gentleman's help..
Orion
|
|
Heath
Stewart
|
|
6/27/2002 12:24:13 AM
|
Not rated
|
Orion, see if anything mentioned here helps.
|
|
Orion
Buttigieg
|
|
6/27/2002 11:45:00 AM
|
Not rated
|
Heath,
right on, thanks. i hadn't gotten to the pt of testing over the internet yet. so that info will save me some hair pulling ;~))
one thing though. i finally got one of my more complicated controls to work which is part of a considerably more complicated application (not too bad as its all C#) but large.
Question: i noticed in Andrew Ma's example and it tests accordingly. that he calls a button event without any special changes to what are clearly VS.NET events. however, when i run mine they don't go. i was curious why you created your own events. did the VS events not work for you..? i've got a serious amount of events for some of these controls and i'd rather avoid having to go in and start altering all the VS code.. just curious..
Note: to get my control to render i had to include pretty well all dll's that the control relies on into the Virtual. otherwise it wouldn't render the object. this is during testing and its in Debug mode and where we use a Blank sln to host/hold all of the application's projects(multi tier app by the way). when we do a release the file structure gets reduced to essentially to one with an exe and the dll's, so at that pt i might not have to put all those dll's into the virtual. we'll see. i'm not sure if this is the case here, but i've noticed a similar bug with VS.NET with Remoting and ClientActivatedObjects. to get it to work i had to take the objects i wanted to remote and put them in their own sln away from any of the client code. you won't know its not working until you test from another machine. this is not the case with ServerActivatedObjects. Just thought i'd pass that advice on.
Orion
|
|
Heath
Stewart
|
|
6/27/2002 12:08:44 PM
|
Avg. Rating: 3 by 1 Users
|
Oh, so there were dependent DLLs. That makes sense now. When you run a control from the web via IE, it creates an AppDomain that can access only its originating directory, which is definitely not DLLs on your hard drive. See, there is a significant amount of security. By default (unless overridden using assembly evidence - not host evidence (it won't work by design)), your control can do almost nothing except talk to it's own directory.
Why did I create my own events? 1) Because I like to, and 2) because I wasn't sure how the late-binding scripting languages would like the whole param thing. I was also using the <script language event for/> notation, which doesn't allow params, though I'm sure you could get it with eventName.arguments. I just needed to throw something together quick for my boss and didn't want to complicate matters in case the function signature needed to match the delegate signature.
|
|
Dan
Azmo
|
|
8/16/2002 3:34:46 AM
|
Not rated
|
Hi I have a similar problem. I made a control that uses another dll. IE only downloads the targer dll (the one given in the HTML page) but not the dependent dll. Of course it doesn't render afterwards. How can I make IE download the dependent dll as well and that load it??
This is kinda important for me...
|
|
Heath
Stewart
|
|
8/17/2002 7:54:23 AM
|
Avg. Rating: 3 by 1 Users
|
You have to use a configuration file. To do so, first put a statement in your HTML doc that contains the .NET user control - between the <head/> tags:
<link rel="Configuration" href="/path/to/MyControl.config"/>
|
Now, you may encounter problems with this because the default machine.config blocks all .config files from being requested (which is weird since the .NET docs say to do the thing above and renaming the extension won't work).
So, open your machine.config (usually in C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\CONFIG), find where is says:
<add verb="*" path="*.config" type="System.Web.HttpForbiddenHandler"/>
|
...and change that to:
<add verb="*" path="Web.config" type="System.Web.HttpForbiddenHandler"/>
|
You shouldn't have to restart IIS for this change to take effect, although it wouldn't hurt. This will block all requests to Web.config, which is the real config file you want to block access to. You can also override this setting your Web application's Web.config file, but I'll leave this as an exersize for the user (I'll give some tips if you'd like).
Now, assuming that your control is MyControl.dll (this works for .exe apps, too) and it's dependency is MyLib.dll, version 1.0.0.0, neutral culture and some public key token like "abcdef0123456789", you would make your MyControl.config like so:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MyLib" culture="neutral"
publicKeyToken="abcdef0123456789"/>
<codeBase version="1.0.0.0"
href="http://www.yourserver.com/path/to/MyLib.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
|
We use this approach for our .exe framework application that has a lot of dependencies it binds to over the Web. What actually happens is that Internet Explorer sees the <link/> tag and knows where to find the .config file that contains this runtime policy, which .NET gives to you for free! Without the <link/> tag, however, this will not work for .dll's. For .exe's however, you don't have to (but it doesn't hurt to) use the <link/> tag; you could just put MyApp.exe.config in the same directory as MyApp.exe, just like you can on a local file system. .NET will check for this case. .dll's can't have their own .config file, however, and use their containing application's .config file (a little tip there). The <link/> tag just helps IE associate a particular .config file with a .dll.
I hope this helps!
|
|
Dan
Azmo
|
|
8/19/2002 4:17:45 AM
|
Not rated
|
I did what u sugested but it didn't work until I raised the .net security for Local Intranet to Full trust. But after this, it worked even if I took out the link to the .config file.
Is it a problem that my control ("MyLib" as you put it) hasn't got a PublicKeyToken (aka is not strong named)?
the html is:
<html>
<head>
<link rel="Configuration" href="/Control.config"/>
</head>
<body>
<object id="APP"
classid="http:Control.dll#Control.MainUC"
height="100%"
width="100%"
VIEWASTEXT
</object>
</body>
</html>
|
and the config file is:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="blsTree" culture="neutral"
publicKeyToken="007a0b78_bf42c201"/>
<codeBase version="1.0.955.24881"
href="http://localhost/blstree.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
|
the public token I took it from the dir where IE downloaded the files. I don't know what it means...
all files: control.html, control.dll, control.config and blstree.dll are in the same dir :wwwroot control.dll is MyControl.dll and blstree.dll is MyLib.dll
you have to increase .net security also?
|
|
Heath
Stewart
|
|
8/19/2002 9:12:10 AM
|
Not rated
|
Yeah, I forgot to mention that, sorry. You really didn't need the <link/> tag? Interesting. IE must try a few combinations that are undocumented. In either case, it doesn't hurt to have it in and I'd go ahead and include it since it is the documented procedure and the hidden "feature" of IE may not last. Besides, future browser support (like the Mozilla plugin I'm working on for .NET in the near future) may depend upon it.
Dependencies don't have to be strongly named, but you should always do this anyway. Just generate a public key token with "sn.exe -k KeyFile.snk" for all your projects and keep it safe. Assemblies that you expose as COM have to be strongly named according to the documention, so you already are doing the procedure and can stick with the same public key token, since that is supposed to identify products from a particular company, although there is really no way to trace it back to the originating company like SSL certs.
|
|
Dan
Azmo
|
|
8/20/2002 2:46:15 AM
|
Not rated
|
OK...so there is no way to do this without modifing the .net security policy?
|
|
Heath
Stewart
|
|
8/20/2002 5:45:27 PM
|
Not rated
|
Right, and this is a good thing. It's actual security, better than in Java and much better than in ActiveX. Sure, it can be a pain, but so can explaining / paying for billions of dollars in hacked company secrets and lost information.
What I'd recommend, that if this is on an Intranet, you could easily distribute an XML or batch file to do this. We do something similar with our products. Let me know if you need help, because I have studied code security for a long time (even before .NET) and may be able to provide some tips.
If this is via the Internet, you could direct people to a page / in a page to download a formatted XML file and run a simple command on it (you could run a simple command to do it all, but the former idea is faster and downloading something gives the users the impression they're not doing as much...seriously).
|
|
Man Sing
Law
|
|
8/20/2002 10:54:57 PM
|
Not rated
|
Heath,
How the object tag be written if a port needs to be specified? Is it
|
|
Heath
Stewart
|
|
8/20/2002 10:58:40 PM
|
Not rated
|
Yeah, it's just like any other href, except you include #namespace.classname after the location. You don't even need to specify a server and I recommend you don't if it's being hosted on the same server/port that the page containing it is on. This makes for more portable code.
Also, whoever posted the message where the HTML gets screwed up, can you please edit you message and make sure that you close any HTML tags? Thank you.
|
|
Heath
Stewart
|
|
8/20/2002 10:58:42 PM
|
Not rated
|
Oops, double-post by mistake.
|
|
Dan
Azmo
|
|
8/21/2002 2:07:41 AM
|
Not rated
|
Thans Heath, if there is a way to set the security from a file, that this would be the best solution for us. I was thinking of something like this but i don't know how to set a security policy from a file (xml if u say so). I would also like to add a site to the trusted sites list, so to increase the security for trusted sites not for intranet. is this posible?
if yes... a sample config file would be great!
|
|
Heath
Stewart
|
|
8/21/2002 12:45:51 PM
|
Avg. Rating: 3 by 1 Users
|
Well, the easiest way would be to just distribute a batch file with the following command (replacing various parameters with your appropriate setup):
caspol.exe -m -ag All_Code -site "INTRANETSVR1" FullTrust -name "OurIntranetServer1" -description "FullTrust CodeGroup for the Intranet server named INTRANETSVR1."
This adds FullTrust permissions for a site named INTRANETSVR1 (an Intranet server machine) and calls the CodeGroup "OurIntranetServer1" with the given description. By default, however, the users won't have caspol.exe in their PATH, so you'll have to take that into account.
If you choose to format an XML file for them to import, they'll have to open the "Microsoft .NET Framework Configuration" MMC tool, drill down "Runtime Security Policy->Machine->Code Groups", right-click on "All_Code" and selected "New...". Then, select the import radion button, find the file, and hit Next, then Finish. Either way, some manual work is required. An XML security policy matching the command-line parameters above would look like this:
<CodeGroup class="System.Security.Policy.UnionCodeGroup, mscorlib, Version=1.0.3300.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Name="OurIntranetServer1"
Description="">
<IMembershipCondition class="System.Security.Policy.SiteMembershipCondition, mscorlib,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Site="INTRANETSVR1"/>
<PermissionSet class="NamedPermissionSet"
version="1"
Name="FullTrust"/>
</CodeGroup>
|
|
|
Richard
Scott
|
|
8/21/2002 9:12:29 PM
|
Not rated
|
Hello all.
I have spent the past several days searching for information on embedding Windows User Controls into Internet Explorer. The DevHood community has provided a fantastic start. The tutorials (thanks Andrew and Heath) and post have been very helpful.
My question is, where do I go next? In other words, are there any books that go into detail on the subject?
I am mainly looking for some information on windows user controls that contain forms (text fields) that are populated by a database. Likewise the text fields' contents will need to be stored back to the database. I know that plain Jane web forms will achieve this but I was hoping for a richer user interface, hence the need to use windows controls.
I understand that this is quite a broad and vague request. I am still assessing the feasibility of using windows controls in IE for a largely "form based" web application. I will need several forms to collect data. IE, a form to collect and display an individual’s demographics, a form to collect and display the same individual’s insurance information and still more forms to collect additional information. I see each of these forms as unique windows user controls.
But I am ahead of myself. First step, I need to create a windows control that pushes and pulls text field data from a database. I can create the windows control and dataGrid to accomplish this in a windows application but when I place the control and dataGrid in IE the dataGrid does not function.
Please excuse my naïve nature... I have exactly 3 days exposure to .NET. My expertise is in Java ... for that reason I am unfamiliar with .NET terminology. Many thanks for any help that can be provided.
Again thanks, -- Richard
|
|
Dan
Azmo
|
|
8/22/2002 3:01:11 AM
|
Not rated
|
Hy Heath very interesting this caspol tool is. But what i need is to raise to security to Full Trust for "Trusted servers" - i think I can do this with caspol, AND add a site to the Trusted List in IE.
This should be something related to IE, not .NET.
|
|
|