473,809 Members | 2,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Security Permission Issue with C# EXE on Intranet

Hi,
My Problem: I have a C# EXE which writes a TXT file with results. It works
perfect on my local computer, but when I try to run it from our network
server (Drive G:), I am getting a
System.Security .Permissions.Se curityPermissio n error.
I found a lot of hints on the internet, also the .NET Framework
Configuration Utility, but I was not successful at all.
Has somebody a very simple to understand solution, what I have to do, to
bring this EXE on the server to run?
Thanks in advance
Johann Pietschnig
pi********@usa. com
May 3 '06 #1
9 1931
Johann,

The .NET framework configuration utility is the way that you want to go.
You will want to create a new security policy based on the assemblies strong
name, or on it's hash (a strong name is better, IMO). Then, you assign it
the permissions you want it to have.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Johann Pietschnig" <abc.piet.com > wrote in message
news:4C******** *************** ***********@mic rosoft.com...
Hi,
My Problem: I have a C# EXE which writes a TXT file with results. It works
perfect on my local computer, but when I try to run it from our network
server (Drive G:), I am getting a
System.Security .Permissions.Se curityPermissio n error.
I found a lot of hints on the internet, also the .NET Framework
Configuration Utility, but I was not successful at all.
Has somebody a very simple to understand solution, what I have to do, to
bring this EXE on the server to run?
Thanks in advance
Johann Pietschnig
pi********@usa. com

May 3 '06 #2
Hi Nicholas,

Thank you for your fast response. Would you know any resource (web site,
book, etc.) which shows you step by step how to perfom this task in the
configuration utility. I tried it, but was not successful.

Thanks again
Johann Pietschnig

"Nicholas Paldino [.NET/C# MVP]" wrote:
Johann,

The .NET framework configuration utility is the way that you want to go.
You will want to create a new security policy based on the assemblies strong
name, or on it's hash (a strong name is better, IMO). Then, you assign it
the permissions you want it to have.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Johann Pietschnig" <abc.piet.com > wrote in message
news:4C******** *************** ***********@mic rosoft.com...
Hi,
My Problem: I have a C# EXE which writes a TXT file with results. It works
perfect on my local computer, but when I try to run it from our network
server (Drive G:), I am getting a
System.Security .Permissions.Se curityPermissio n error.
I found a lot of hints on the internet, also the .NET Framework
Configuration Utility, but I was not successful at all.
Has somebody a very simple to understand solution, what I have to do, to
bring this EXE on the server to run?
Thanks in advance
Johann Pietschnig
pi********@usa. com


May 3 '06 #3
Before attempting to grant additional permissions to your application, it
might be best to figure out whether you can find a way to accomplish the
desired functionality without elevating privilege. In this particular case,
does the user select the target file location via a file save dialog? If
not, does it matter where the file is located, or is it only important that
your application be able to locate the data?
"Johann Pietschnig" <abc.piet.com > wrote in message
news:4C******** *************** ***********@mic rosoft.com...
Hi,
My Problem: I have a C# EXE which writes a TXT file with results. It works
perfect on my local computer, but when I try to run it from our network
server (Drive G:), I am getting a
System.Security .Permissions.Se curityPermissio n error.
I found a lot of hints on the internet, also the .NET Framework
Configuration Utility, but I was not successful at all.
Has somebody a very simple to understand solution, what I have to do, to
bring this EXE on the server to run?
Thanks in advance
Johann Pietschnig
pi********@usa. com

May 3 '06 #4
Hi Nicole,
Thanks for your reply.

In my case the program makes a calculation and puts 2 numbers in a .TXT file
in the same directory. I think this is just a simple IO function.
Are there ways in .NET 2.0 to handle this in C# code?
Thanks again

Johann Pietschnig
"Nicole Calinoiu" wrote:
Before attempting to grant additional permissions to your application, it
might be best to figure out whether you can find a way to accomplish the
desired functionality without elevating privilege. In this particular case,
does the user select the target file location via a file save dialog? If
not, does it matter where the file is located, or is it only important that
your application be able to locate the data?
"Johann Pietschnig" <abc.piet.com > wrote in message
news:4C******** *************** ***********@mic rosoft.com...
Hi,
My Problem: I have a C# EXE which writes a TXT file with results. It works
perfect on my local computer, but when I try to run it from our network
server (Drive G:), I am getting a
System.Security .Permissions.Se curityPermissio n error.
I found a lot of hints on the internet, also the .NET Framework
Configuration Utility, but I was not successful at all.
Has somebody a very simple to understand solution, what I have to do, to
bring this EXE on the server to run?
Thanks in advance
Johann Pietschnig
pi********@usa. com


May 3 '06 #5
When the application is run from the server, do you really want the file to
be saved to the server share? If not, what do you mean by "same directory"?
"Johann Pietschnig" <abc.piet.com > wrote in message
news:67******** *************** ***********@mic rosoft.com...
Hi Nicole,
Thanks for your reply.

In my case the program makes a calculation and puts 2 numbers in a .TXT
file
in the same directory. I think this is just a simple IO function.
Are there ways in .NET 2.0 to handle this in C# code?
Thanks again

Johann Pietschnig
"Nicole Calinoiu" wrote:
Before attempting to grant additional permissions to your application, it
might be best to figure out whether you can find a way to accomplish the
desired functionality without elevating privilege. In this particular
case,
does the user select the target file location via a file save dialog? If
not, does it matter where the file is located, or is it only important
that
your application be able to locate the data?
"Johann Pietschnig" <abc.piet.com > wrote in message
news:4C******** *************** ***********@mic rosoft.com...
> Hi,
> My Problem: I have a C# EXE which writes a TXT file with results. It
> works
> perfect on my local computer, but when I try to run it from our network
> server (Drive G:), I am getting a
> System.Security .Permissions.Se curityPermissio n error.
> I found a lot of hints on the internet, also the .NET Framework
> Configuration Utility, but I was not successful at all.
> Has somebody a very simple to understand solution, what I have to do,
> to
> bring this EXE on the server to run?
> Thanks in advance
> Johann Pietschnig
> pi********@usa. com
>
>


May 3 '06 #6
The purpose of the C# EXE is to hand over the .TXT file to a Visual Foxpro
Program, which is in the same directory as the C# .EXE on the server.
The Visual Foxpro Program is waiting for this TXT file and picks it up, as
soon as is generated.
This is just a Setup until the Visual Foxpro Program is also rewritten in C#.

Thanks

Johann Pietschnig
"Nicole Calinoiu" wrote:
When the application is run from the server, do you really want the file to
be saved to the server share? If not, what do you mean by "same directory"?
"Johann Pietschnig" <abc.piet.com > wrote in message
news:67******** *************** ***********@mic rosoft.com...
Hi Nicole,
Thanks for your reply.

In my case the program makes a calculation and puts 2 numbers in a .TXT
file
in the same directory. I think this is just a simple IO function.
Are there ways in .NET 2.0 to handle this in C# code?
Thanks again

Johann Pietschnig
"Nicole Calinoiu" wrote:
Before attempting to grant additional permissions to your application, it
might be best to figure out whether you can find a way to accomplish the
desired functionality without elevating privilege. In this particular
case,
does the user select the target file location via a file save dialog? If
not, does it matter where the file is located, or is it only important
that
your application be able to locate the data?
"Johann Pietschnig" <abc.piet.com > wrote in message
news:4C******** *************** ***********@mic rosoft.com...
> Hi,
> My Problem: I have a C# EXE which writes a TXT file with results. It
> works
> perfect on my local computer, but when I try to run it from our network
> server (Drive G:), I am getting a
> System.Security .Permissions.Se curityPermissio n error.
> I found a lot of hints on the internet, also the .NET Framework
> Configuration Utility, but I was not successful at all.
> Has somebody a very simple to understand solution, what I have to do,
> to
> bring this EXE on the server to run?
> Thanks in advance
> Johann Pietschnig
> pi********@usa. com
>
>


May 3 '06 #7
In most work environments it is usualy OK (and much simpler) to simply raise
the trust level of the Intranet (The Zone Security option) to "Full Trust".

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Johann,

The .NET framework configuration utility is the way that you want to
go. You will want to create a new security policy based on the assemblies
strong name, or on it's hash (a strong name is better, IMO). Then, you
assign it the permissions you want it to have.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Johann Pietschnig" <abc.piet.com > wrote in message
news:4C******** *************** ***********@mic rosoft.com...
Hi,
My Problem: I have a C# EXE which writes a TXT file with results. It
works
perfect on my local computer, but when I try to run it from our network
server (Drive G:), I am getting a
System.Security .Permissions.Se curityPermissio n error.
I found a lot of hints on the internet, also the .NET Framework
Configuration Utility, but I was not successful at all.
Has somebody a very simple to understand solution, what I have to do, to
bring this EXE on the server to run?
Thanks in advance
Johann Pietschnig
pi********@usa. com


May 4 '06 #8
The default CAS permission grant for the intranet zone includes permission
to read from, but not write to, its directory of origin. This means that
you will either need to grant additional permissions to your assembly on the
client machine(s) or find an alternate means of saving the file. One option
that would not involve altering client-side permissions would be to pass the
data to a web service on the same server for writing to the desired target
file.

On the other hand, if you're using (or can upgrade to) v. 2.0 of the .NET
Framework, ClickOnce might also be an option. It would allow users to grant
additional permissions to your application without requiring separate
permission elevation steps. If you're using v. 1.x, you'll need to deploy
the policy modifications under administrative privileges. See
http://msdn.microsoft.com/library/de...ecpoladmin.asp
for some options, and talk to your network admin. There may already be
something in place for distributing CAS policy changes and, if not, your IT
folks should still be involved in selecting CAS policy modification
approaches
..
"Johann Pietschnig" <abc.piet.com > wrote in message
news:8A******** *************** ***********@mic rosoft.com...
The purpose of the C# EXE is to hand over the .TXT file to a Visual Foxpro
Program, which is in the same directory as the C# .EXE on the server.
The Visual Foxpro Program is waiting for this TXT file and picks it up, as
soon as is generated.
This is just a Setup until the Visual Foxpro Program is also rewritten in
C#.

Thanks

Johann Pietschnig
"Nicole Calinoiu" wrote:
When the application is run from the server, do you really want the file
to
be saved to the server share? If not, what do you mean by "same
directory"?
"Johann Pietschnig" <abc.piet.com > wrote in message
news:67******** *************** ***********@mic rosoft.com...
> Hi Nicole,
> Thanks for your reply.
>
> In my case the program makes a calculation and puts 2 numbers in a .TXT
> file
> in the same directory. I think this is just a simple IO function.
> Are there ways in .NET 2.0 to handle this in C# code?
> Thanks again
>
> Johann Pietschnig
>
>
> "Nicole Calinoiu" wrote:
>
>> Before attempting to grant additional permissions to your application,
>> it
>> might be best to figure out whether you can find a way to accomplish
>> the
>> desired functionality without elevating privilege. In this particular
>> case,
>> does the user select the target file location via a file save dialog?
>> If
>> not, does it matter where the file is located, or is it only important
>> that
>> your application be able to locate the data?
>>
>>
>> "Johann Pietschnig" <abc.piet.com > wrote in message
>> news:4C******** *************** ***********@mic rosoft.com...
>> > Hi,
>> > My Problem: I have a C# EXE which writes a TXT file with results. It
>> > works
>> > perfect on my local computer, but when I try to run it from our
>> > network
>> > server (Drive G:), I am getting a
>> > System.Security .Permissions.Se curityPermissio n error.
>> > I found a lot of hints on the internet, also the .NET Framework
>> > Configuration Utility, but I was not successful at all.
>> > Has somebody a very simple to understand solution, what I have to
>> > do,
>> > to
>> > bring this EXE on the server to run?
>> > Thanks in advance
>> > Johann Pietschnig
>> > pi********@usa. com
>> >
>> >
>>
>>
>>


May 4 '06 #9
Hi,

Try this:

1. Go to Administrative tools and select Microsoft .NET framework wizards
2. Select Adjust .NET security
3. Select Make changes to this computer
4. Select Local Intranet
5. Move the slider up to full trust


"Johann Pietschnig" <abc.piet.com > wrote in message
news:4C******** *************** ***********@mic rosoft.com...
Hi,
My Problem: I have a C# EXE which writes a TXT file with results. It works
perfect on my local computer, but when I try to run it from our network
server (Drive G:), I am getting a
System.Security .Permissions.Se curityPermissio n error.
I found a lot of hints on the internet, also the .NET Framework
Configuration Utility, but I was not successful at all.
Has somebody a very simple to understand solution, what I have to do, to
bring this EXE on the server to run?
Thanks in advance
Johann Pietschnig
pi********@usa. com

May 4 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2366
by: Namratha Shah \(Nasha\) | last post by:
Hey Guys, Before we start with our sample app we need to view the security configuration files on the machine. You will find them under <drive>\WInNT\Microsoft.NET\FrameWork\<version>\Config Enterprise Level Security configuration file is :- enterprise.config Machine Level Security configuration file is :- security.config
1
2390
by: web1110 | last post by:
Hi, I set up my wifes machine to run .NET, some of my stuff runs but not all. First example: I have a windows program that displays environment info. It runs fine on my machine. Whan I run it on my wifes' machine over the network it fails on the statement:
0
1030
by: Dave | last post by:
I have a C# application that I want to run as a "smart client", by executing the exe through IE pointing to an intranet server. I need to increase permissions to the application because it accesses a local SQL server, and the Intranet zone by default doesn't have rights to do this (SqlClientPermission). So, I assigned FullTrust to the URL that points to my app through the .NET configuration tool. Everything was working fine until I...
0
2099
by: Namratha Shah \(Nasha\) | last post by:
Hey Guys, Today we are going to look at Code Access Security. Code access security is a feature of .NET that manages code depending on its trust level. If the CLS trusts the code enough to allow it ro run then it will execute, the code execution depends on the permission provided to the assembly. If the code is not trusted wnough to run or it attempts to perform an action which doe not have the required permissions then its execution...
16
2130
by: Marina | last post by:
Hi, I am trying to find the minimum security settings to allow a windows control embedded in IE have full trust. If I give the entire Intranet zone full trust, this works. However, this is very broad and gives the entire zone high privleges. I tried giving just the assembly full trust (using the full URL for the DLL), but this doesn't seem to work.
5
1109
by: Jarod_24 | last post by:
How do i prevent getting a System.Security.SecurityException when running my app from a Network Drive? My app stopped when checking for a previous instance of itself using the code: Private Function prevInstance() As Boolean Dim pProcess As Diagnostics.Process() pProcess = Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrent
1
2683
by: jmurphy95 | last post by:
Hi there, I have a Windows application that I'm running from a shared drive that needs to access file/directory resources on other drives. I've done a lot of reading, but a lot of the material out there relates to the 1.1 Framework as opposed to 2.0. I've added the following lines to my AssemblyInfo.vb: <Assembly: System.Security.AllowPartiallyTrustedCallers()> <Assembly: System.Security.SecurityTreatAsSafe()>
3
5700
by: =?Utf-8?B?dG9ieQ==?= | last post by:
Our company deploys our .NET 2.0 apps to a network drive for them to be run. We are having issues with security in getting these to run. Below is a sample output for a job that is trying to call a DLL and failing. Since the .NET 2.0 Config control panel applet is no longer included with the framework, we ran the following command line to allow full trust on Local Intranet apps: c:\windows\microsoft.net\framework\v2.0.50727\caspol.exe...
7
5613
by: GMiller | last post by:
I am fairly new to .NET programming so this may be a simplistic question. I wrote a C# application that reads and writes files. If the program resides on a local drive everything is fine. If the program resides on a network drive then I get the following error. System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral,...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10379
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7660
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3014
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.