|
|
.net 2.0 security breaks my app |
|
Author |
Message |
jsbWS

|
Posted: Windows Forms General, .net 2.0 security breaks my app |
Top |
Hello,
I've written a windows control that runs in an asp.net page using an <object> tag. The control accesses a scanner on the local machine.
Everything was working fine until I installed .net 2.0 as part of the SQL Server Management Studio Express.
Now the control throws an error "Application attempted to perform an operation not allowed by the security policy"
I've tried giving the .dll permisson using the .net framework 1.1 configuration tool. So far nothing seems to work.
Thanks for any help.
Jon
Windows Forms34
|
|
|
|
 |
JRQ

|
Posted: Windows Forms General, .net 2.0 security breaks my app |
Top |
This looks like a case of .net 2.0 running instead of .net 1.1 security policy checking. I had the same problem with a winapp which was solved by adding a myapp.exe.manifest file that tells exactly what framework version to load. There is probably something similar with ASP.NET where you can specify which framework version you want. It's more likely it's just a setting in IIS management screen.
|
|
|
|
 |
jsbWS

|
Posted: Windows Forms General, .net 2.0 security breaks my app |
Top |
You are correct, looking at the error box, mscorlib.dll from .net 2.0 is running instead of the one for .net 1.1
That's a big help, thanks.
The next question then, is how do I get the windows control to specify the proper version of the .dll The server is set properly to .net 1.1, but the control runs in the local machine environment, not on the server.
|
|
|
|
 |
JRQ

|
Posted: Windows Forms General, .net 2.0 security breaks my app |
Top |
Is it something that gets installed locally If yes try this;
Go to the directory where the assembly file was copied, and try to add a text mycontrol.dll.config or mycontrol.exe.config. (<controlfile.ext>.config), and put something like this.
< xml version="1.0" encoding="utf-8" > <configuration> <startup> <supportedRuntime version="v1.1.4322" /> </startup> <appSettings> <!-- User application and configured property settings go here.--> <!-- Example: <add key="settingName" value="settingValue"/> --> </appSettings> </configuration>
|
|
|
|
 |
jsbWS

|
Posted: Windows Forms General, .net 2.0 security breaks my app |
Top |
Thanks again.
The dll doesn't seem to install on the local machine, rather it seems to run in memory and then disappear. I'll try injecting the config file into the .dll after it's compiled. Perhaps that will work.
|
|
|
|
 |
JRQ

|
Posted: Windows Forms General, .net 2.0 security breaks my app |
Top |
You might want to post this question to the ASP.NET forum. It's very likely that someone else there has encountered this problem too.
|
|
|
|
 |
Whatabohr

|
Posted: Windows Forms General, .net 2.0 security breaks my app |
Top |
For controls hosted in the browser the latest installed version of the CLR will always be used. This is by design and there is no way around it that isn't a very dirty hack.
Why don't you just change the v2.0 security policy on the machine to allow you whatever permissions you are currently allowing on v1.* already
|
|
|
|
 |
JRQ

|
Posted: Windows Forms General, .net 2.0 security breaks my app |
Top |
2.0 and 1.1 security policies are different.
|
|
|
|
 |
JRQ

|
Posted: Windows Forms General, .net 2.0 security breaks my app |
Top |
I just read that IE will ALWAYS use the lastest framework version installed on the client machine. So there is no way to tell IE to use specific version of the framework.
|
|
|
|
 |
|
|