Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Permissions and .Net Framework Config
 

Permissions and .Net Framework Config

I was having a security problem with my VB 2008 windows application - it would not run and gave me the following error, even from my developer machine:
"Application attempted to perform an operation not allowed by the security policy. To grant this application the required permission ... or use the .Net framework configuration tool."

My developer machine has .Net Framework 2.0 Configuration (version 2.0.50727.42). I was able to grant the necessary permissions on my developer machine.

When I looked for the utility on a user's machine, all that is there is .Net Framework 1.1.4322. The user machines all have .Net Framework 3.5 installed on them.

QUESTIONS: 1. Is there a way I can include the necessary permissions in code and if so, what is the code?
2. Where would the code go? (Explicitly what page(s) to include it it.)
3. If not, I would have to find and install .Net Framework 2.0 on all user computers. Where can I get it?
4. Is there a vbscript I can use to automatically set permissions on all user computers?

Any help with this issue will be appreciated.
Shannon10  Friday, August 28, 2009 3:46 PM
If the user machine truly has .Net 3.5 installed on it, then it also has 1.0, 1.1, 2.0 and 3.0. You can't just install .Net 3.5; the CLR for that is 2.0.

What are you doing that requires granting permissions? This seems pretty risky to me, as you may open a security hole on your clients' computers this way that can be taken advantage of by someone nefarious.

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Monday, August 31, 2009 2:42 AM
Thanks for your response.

A more detailed error message I'm receiving on the Test User Machine is: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

The test user machine has the following on it (under Add/Remove Programs):
Microsoft .NET Framework 1.1
Microsoft .NET Framework 1.1 Hotfix (KB928366)
Microsoft .NET Framework 2.0 Service Pack 1
Microsoft .NET Framework 3.0 Service Pack 1
Microsoft .NET Framework 3.5

I am unable to locate mscorcfg.msc on the Test User Machine, except the Framework 1.1 version (Control Panel -> Microsoft .Net Framework Configuration).

Other Visual Basic 2008 projects run on the Test User Machine with no problem.


QUESTIONS: 1. Is there a way I can include the necessary permissions in code and if so, what is the code?
2. Where would the code go? (Explicitly what page(s) to include it in.)
3. If not, I would have to find and install .Net Framework 2.0 on all user computers. Where can I get it?
4. Is there a vbscript I can use to automatically set permissions on all user computers?

Any help will be greatly appreciated!
Shannon10  Monday, August 31, 2009 3:22 PM
There is something in your project that is expecting some kind of configuration change to the .Net framework. If I were you, I would spend as much time as it takes trying to figure out what it is. Try disabling or removing from project or commenting out or something, until the problem goes away. Only at that time can you figure out exactly what to do about it.

The .NET Framework 1.1 has a different common language runtime (mscorlib), so using its configuration to configure .Net 2.0 seems dangerous to me, as does configuring .Net 2.0 without knowing why you have to.

I don't understand why you ask "what page" to put the code in. How can someone who doesn't know what your application does or how it runs tell you that?

You don't have to install the .Net 2.0 framework on the computers. Like I said before, if you have .Net 3.5, you have all of them. You might consider installing SP-1 for .Net 3.5 and see if that makes any difference.

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Tuesday, September 01, 2009 4:00 AM

You can use google to search for other answers

Custom Search

More Threads

• â€œUnrecoverable Build Errorâ€?..
• Prerequisite could not be found for bootstrapping
• Regarding Setup Project in VS 2003
• No-Touch Deployment
• I have exe and dll. How can I use ClickOnce?
• Smart Client Installation Problem
• Specify Arguments Shortcut with Application Folder value
• Security issue with strong named hosted DLL
• Computer reset after running setup
• Deploying .NET Activex control