473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

dotnet security exception issues

My version of dotnet is 7.0.9955 Studio 2002. The applications I've
written refuse to run on our shared network drive, giving security
exceptions. I've not been able to find a workaround for this problem and
the VS 2002 MSDN stinks.

My question is, has any of this improved with the latest dotnet version?
I'm still using VS 6.0 for development and I don't want to buy the
latest stuff if it doesn't work for me. My applications MUST run from
the network without fussing with security.

Thanks
Apr 21 '06 #1
5 1424
Hi,

When you run code from your local machine, it runs in the MyComputer
security zone, but when you run it off of a server, or network share,
it runs in the LocalIntranet zone. The latter imposes much stricter
restrictions on your code. That would be the reason why you're getting
SecurityExceptions.

Your best option in this case would be to strong name your assemblies
(once you've finished development on them), and then use the .NET
Framework configuration tool to assign a higher level of Trust to these
assemblies. Or create a new code group with a higher trust
configuration, and add your assemblies to that code group.
has any of this improved with the latest dotnet version?


Probably yes, but it still works quite well with VS 2002. I too have
2002 and have no such problems. Those security features are for your
benefit, remember. ;-)

Regards,

Cerebrus.

Apr 21 '06 #2
Thanks for the reply. I'll give it a shot and see if I can make this
work.

I've created a strong key .snk file and put reference to it in the
assembly module, but no matter where I stick the file the compiler says
it can't find it. Where is the file supposed to be?

Thanks

Dave

Cerebrus wrote:

Hi,

When you run code from your local machine, it runs in the MyComputer
security zone, but when you run it off of a server, or network share,
it runs in the LocalIntranet zone. The latter imposes much stricter
restrictions on your code. That would be the reason why you're getting
SecurityExceptions.

Your best option in this case would be to strong name your assemblies
(once you've finished development on them), and then use the .NET
Framework configuration tool to assign a higher level of Trust to these
assemblies. Or create a new code group with a higher trust
configuration, and add your assemblies to that code group.
has any of this improved with the latest dotnet version?


Probably yes, but it still works quite well with VS 2002. I too have
2002 and have no such problems. Those security features are for your
benefit, remember. ;-)

Regards,

Cerebrus.

Apr 21 '06 #3
Dave Cullen wrote:
The applications I've written refuse to run on our shared network drive,
giving security exceptions.
Look into Code Access Security polies (caspol.exe).
You need to convince the Framework that your network share is as
"trustworthy" as your local disks.
My question is, has any of this improved with the latest dotnet version?
The same security model (more or less) exists in all versions of the
Framework. The way it works is completely deliberate and isn't likely
to change any time soon.
I'm still using VS 6.0 for development and I don't want to buy the
latest stuff if it doesn't work for me. My applications MUST run from
the network without fussing with security.


If you want any machine to run CLR code from a network share, you either
have to keep your applications /extremely/ simplistic, so as to work
within the Framework's security "sandbox" or more likely, as you put it,
"fuss with security".

Regards,
Phill W.
Apr 21 '06 #4
>> I've created a strong key .snk file and put reference to it in the
assembly module, but no matter where I stick the file the compiler says
it can't find it. Where is the file supposed to be?
Yeah, this behaviour is a bit quirky. I usually put the .snk file in
the same folder in which the .vbproj file (and the AssemblyInfo.vb
file) reside. Then in the AssemblyInfo.vb file, I add :

<Assembly: AssemblyKeyFile("..\..\myKeyName.snk")>

I haven't understood this behaviour till now, since if I'm putting in a
relative path to the assembly, which resides in the bin directory, I
should be using "..\myKeyName.snk", but that doesn't seem to work. But
the above line does work, so I stopped questioning it ! ;-)
I'll give it a shot and see if I can make this work.


Believe me, it works. It's a common issue, so don't worry yourself.

Regards,

Cerebrus.

Apr 21 '06 #5
OK, I got the project to compile. Thanks for the tip on path specs.

But... If I copy the exe to the share drive, I still get a security
exception when I run it. It looks like the .NET configuration tool will
only change the target computer to "trust" the assembly. Is that true?
Does every machine need to have the security level for the assembly
changed?

Thanks for the help.

Dave

Cerebrus wrote:
I've created a strong key .snk file and put reference to it in the
assembly module, but no matter where I stick the file the compiler says
it can't find it. Where is the file supposed to be?
Yeah, this behaviour is a bit quirky. I usually put the .snk file in
the same folder in which the .vbproj file (and the AssemblyInfo.vb
file) reside. Then in the AssemblyInfo.vb file, I add :

<Assembly: AssemblyKeyFile("..\..\myKeyName.snk")>

I haven't understood this behaviour till now, since if I'm putting in a
relative path to the assembly, which resides in the bin directory, I
should be using "..\myKeyName.snk", but that doesn't seem to work. But
the above line does work, so I stopped questioning it ! ;-)
I'll give it a shot and see if I can make this work.


Believe me, it works. It's a common issue, so don't worry yourself.

Regards,

Cerebrus.

Apr 21 '06 #6

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

Similar topics

0
by: Sean Newton | last post by:
I am absolutely bewildered by now by the Microsoft.Samples SSPI and Security assemblies. I've been trying to set these up in a very straightforward harness in the way that I'd like to be able to...
40
by: Eitan | last post by:
Hello, I know Java-Applet (written for JBuilder). I would like to know about dotnet technology, pros and cons in comparation to Java-Applet technololgy. Can I write a program in dotnet, like...
2
by: Matt Theule | last post by:
Where can I find information about Runtime Security Policies? I have a winform that is hosted in a webform that needs to access the filesystem. Using the Configuration mmc snapin, I have created a...
6
by: Ken Galer | last post by:
I am working on a small project that I started at home. It originally was on the C: drive and was working properly. After bringing it to work I placed it in a folder on the server with the other...
2
by: Priya | last post by:
Hi, I'm developing an ASP.NET application. I imported a C++ dll into the C# code. When I tried to access a function in that dll, application threw an exception...
4
by: androoo | last post by:
Hi I have a windows control I embed onto an aspx page which is grabbing a dataset from the client and sending it to the server through a webservice. This works fine in a windows app. However...
1
by: Tom Purdom | last post by:
Hi All, I am developing a Outlook interop plugin which performs task time allocation. However when i attempt to fire my custom event to notify that an allocation has been generated the security...
2
by: rbanerji | last post by:
I am building a BHO that is meant to popup a IHtmlPopup window on a mouse over image event. All the code works fine if the image is in the main Window. However if the image is in a frame then I...
2
by: =?Utf-8?B?RGFuaQ==?= | last post by:
Hi, I'm running a little wcf service, regular operations works fine, but when the returned type is a DataTable like this: DataTable GetItems(); (The call reaches the server, it fails...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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...

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.