473,473 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Assembly crashes when run from network location

I've created an assembly that, because of 3rd party controls, requires full
trust to run. This is no problem when running from the local harddrive, but
when the application is run from a network drive, the application crashes and
want's to send information to Microsoft.
To deal with this, I added code to demand PermissionState.Unrestricted
before any other code is executed. I also added a strong name to facilitate
giving full trust to the application when run from the local intranet.
This solution works like a charm on my computer. When run from the network
location, I receive a message informing me I do not have sufficient
permissions. Using the wizard in the Administrative Tools I can easily allow
my application to run from the network drive.
Content with myself I walk to a collegue to demonstrate the polite message.
I double click the app on the network drive and watch in horror how it
crashes and wants to send info to Microsoft. Searching for the configuration
wizard, I find that users without VS2005 don't get that tool.

My questions:
1. Why does my app crash in stead of displaying my messagebox? What have I
missed?
2. Is there a way to obtain the configuration wizard for framework 2.0
without VS2005? I don't want to change security settings myself, since the
app will mainly be run from the local drive. The wizard is a lot easier to
use for my users than caspol.

Used code (taken from the Sudoku sample on MSDN):
[STAThread]
static void Main()
{

if (HasFullTrust)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new Forms...);
}
else
MessageBox.Show("Error...");
}

}

private static bool HasFullTrust
{
get
{
try
{
new PermissionSet(PermissionState.Unrestricted).Demand ();
return true;
}
catch (SecurityException) {return false;}
}
}

Mar 21 '07 #1
1 1722
Ok, I've found part of the problem.
The crash is caused because, for some reason, the referenced 3rd party
control crashes my app before the first line of code is executed. When I add
a Full trust CAS code group for the strong name of the 3rd party control, the
app functions as expected.
The reason my app returned a polite error message, whereas it just crashes
on my colleague’s machine, is that the 3rd party control is also present in
my CAG. I missed that the first time.
I still hope someone can tell me why the 3rd party control crashes my app
before a single line of code is executed. I prefer to show an error message
over the 'send info to Microsoft' dialog.
Mar 23 '07 #2

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

Similar topics

1
by: cybertof | last post by:
Hello, I have a custom Excel 2003 .dll assembly, and each time i rebuild the assembly and place it on the client PC, i have to apply again the security on the new assembly (same location). Is...
3
by: Boris | last post by:
I notice the following strange behavior of the applications running under ..NET Framework. Let say I have application MyApp.exe which reference assembly MyAssembly.dll. The MyAssembly.dll is...
2
by: wsMarkM | last post by:
I have a web app running on Windows 2000 with the home directory pointed to a network share on a file server. We have a long running process which copies jpg images from user's folders on a network...
0
by: Christian Kaiser | last post by:
I want to develop code on a network (mapped) drive. All the time the execution fails with a security exception. OK, I thought I know the reason for that, and set the intranet security to full...
1
by: Patrick | last post by:
Has been trying to get an ASP.NET DLL's modification date/time for the "release date/time" to be displayed on the page's footer Using: System.Reflection.Assembly...
0
by: R Reyes | last post by:
ISSUE (reposted) =========================== Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? For many people, they say they add the...
3
by: bilaribilari | last post by:
Hello, I have a huge application thats written in C and C++. The application crashes and I am trying to find a pattern to these crashes. I recently got my hands on the DrWatson log and the...
2
by: Vandana T | last post by:
I created a console application to read and manipulate an Excel file. I added reference to the Microsoft Excel 11.0 Object Library. When I place it in Network Drive and try to run the .exe from my...
1
by: Carl Johansson | last post by:
I think I'm going nuts! I have a perfectly fine exe assembly built with Microsoft Visual C# 2008 Express Edition. When executed from my local hard drive it runs as exactly as expected. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.