By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,826 Members | 815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,826 IT Pros & Developers. It's quick & easy.

Security Permission Issue with C# EXE on Intranet

P: n/a
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.SecurityPermission 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
Share this Question
Share on Google+
9 Replies


P: n/a
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.com

"Johann Pietschnig" <abc.piet.com> wrote in message
news:4C**********************************@microsof t.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.SecurityPermission 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

P: n/a
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.com

"Johann Pietschnig" <abc.piet.com> wrote in message
news:4C**********************************@microsof t.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.SecurityPermission 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

P: n/a
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**********************************@microsof t.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.SecurityPermission 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

P: n/a
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**********************************@microsof t.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.SecurityPermission 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

P: n/a
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**********************************@microsof t.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**********************************@microsof t.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.SecurityPermission 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

P: n/a
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**********************************@microsof t.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**********************************@microsof t.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.SecurityPermission 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

P: n/a
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.com> wrote in
message news:%2****************@TK2MSFTNGP02.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.com

"Johann Pietschnig" <abc.piet.com> wrote in message
news:4C**********************************@microsof t.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.SecurityPermission 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

P: n/a
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**********************************@microsof t.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**********************************@microsof t.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**********************************@microsof t.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.SecurityPermission 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

P: n/a
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**********************************@microsof t.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.SecurityPermission 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 discussion thread is closed

Replies have been disabled for this discussion.